Professional Documents
Culture Documents
c programs
c programs
NAME
RNO SCORE
#include<stdio.h>
int main()
printf("name\n");
printf("\nrollno\tSCORE");
return 0;
Output:
5. Write a C program to swap two numbers: a. using a temporary variable. b. without using a
temporary variable.
10. Write a C program to input a number from 1-7 and print the corresponding day of the week.
Use switch.
11. Write a C program to input the date and provide the output in words as shown below: Sample
input: Day- 1 Month- 3 Year- 2023 Output: 1st March 2023.
12. Write a C program to print all the even numbers from 2 to 50.
14. Write a C program to print the sum of first 'n' natural numbers.
#include<stdio.h>
int main()
int i,n,sum=0;
scanf("%d",&n);
for(i=2;i<n;i++)
if (n%i==0);{
printf("prime");
break;
else
printf("not");
return 0;
18. Write a C program to reverse a given number and check whether it is a palindrome or not
* *
* * *
* * * *
2 2
3 3 3
4 4 44
24. Write a C program to find the sum of the following series: a. 1+2+3+4+... n 2 b.
12+22+32+42+......n2 c. 1/1! + 2/2! + 3/3! +4/4! +..... n/n! d. x - x3/3! + x5/5! -.......