Programs in control statement
1) Write a C program to check whether a number is positive or
negative
Output
Enter any number : 14
14 is a positive number
2) Write a C program to check whether a given number is even or
odd.
Output
Enter any number : 15
15 is an odd integer
3) Write a C program to find whether a given year is leap year or
not.
Output
Enter the year : 2016
2016 is a leap year.
4) Write a C program to read the age of a candidate and determine
whether it is eligible for casting his/her own vote.
Output
Enter your age : 21
Congratulation! You are eligible for casting your vote.
5) Write a C program to find the sum of even numbers between 1 and
n
Output
Enter any number: 10
Sum of all even number between 1 to 10 = 30
6) Write a C program to find the sum of odd numbers from 1 to n
Output
Enter any number: 10
Sum of all odd number between 1 to 10 = 25
7) Write a C program to find reverse of a given number
Output
Enter any number to find reverse: 1234
Reverse = 4321
8) Write a C program to check whether a given number is Armstrong
or not
Output
Enter any number to check Armstrong number: 371
371 is Armstrong number.
9) Write a C program to find whether the given number is prime or
not
Output
Enter any number to check prime: 7
7 is prime number
10) Write a C program to find factorial of a given number
Output
Enter any number to calculate factorial: 5
Factorial of 5 = 120
11) Write a C program to check whether a number is palindrome or
not
Output
Enter any number to check palindrome: 121
121 is palindrome.
12) Write a C program to check whether a number is perfect or not
Output
Enter any number to check perfect number: 6
6 is a Perfect number
13) Write a C program to check whether the given number is perfect
square or not
Output
Enter a number : 36
36 is a perfect square
14) Write a C program to enter any number and check whether
number is Strong number or not.
output
Enter any number to check Strong number: 145
145 Strong number
15)Write a C program to implement menu driven calculator