Question 01

Write a C program to calculate the sum of the first n natural numbers, where n is provided by the user. Display the result.

Question 02

Write a C program to calculate the factorial of a given number n, where n is provided by the user. Display the result.

Question 03

Write a C program to reverse the digits of a given positive integer n, where n is provided by the user. Display the reversed number.

Question 04

Write a C program to repeatedly ask the user to input a number. The program should terminate when the user enters -1. After termination, display the total count of numbers entered (excluding -1).

Question 05

Write a C program to ask the user for their age repeatedly. If the user enters an age less than 0 or greater than 120, display a message asking the user to enter a valid age.

Question 06

Write a C program to simulate a simple menu-driven program. The program should present the user with a menu of options:

  1. Print "Hello, World!"

  2. Print the current year

  3. Exit the program.

The program should repeatedly display the menu and ask the user to choose an option until the user selects the option to exit (option 3).

Last modified: Saturday, 23 November 2024, 6:36 PM