Assignment - Suman Shrestha
Assignment - Suman Shrestha
6. Write a C program to find the sum of all the even numbers, and all
the odd numbers “separately” within the range of number entered
by user ( range is like : from 20 to 40)
7. Write a C Program to generate a multiplication table of a number
entered by user.
#include <stdio.h>
int main() {
while (even_count<3) {
printf("Enter an integer: ");
scanf("%d", &num);
if (num%2==0) {
even_count++;
even_sum += num;
printf("You entered an even number: %d\n", num);
}
}
return 0;
}
13. WAP to check whether a number is Armstrong or not? (user can
enter any length of integer)
14 Write a program in C that calculates the sum of digits entered by the
user successively until the sum reduces to a single digit number. For
example 12345=>1+2+3+4+5=15, 15=>1+5=6.
15. WAP to display all the Prime numbers which lies between 50 and
100.
16. WAP to display the factorial of all the integers from 1 to ’n’, where n
is entered by the user.
17. WAP to take ’n’ as input, and display the multiplication table of all
the integers from 1 to ’n’, as in the following screenshot
1. Ans
2. Ans
3. Ans
4. Ans
5. Ans