Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.

Write a C program to print your details as follows:

NAME

RNO SCORE

#include<stdio.h>

int main()

printf("DIYA SICILY SIJU\n");

printf("\n23MIS0045\tSCORE");

return 0;

Output:

2. Write a C program to print the sum of two numbers.

3. Write a C program to find the sum and average of three numbers.

4. Write a C program to convert the temperature in celecius to farenheit.

5. Write a C program to swap two numbers: a. using a temporary variable. b. without using a
temporary variable.

6. Write a C program to check whether a given number is odd or even.

7. Write a C program to check whether a given number is positive, negative or zero.


8. Write a C program to print the largest of three numbers.

9. Write a C program to print the roots of a quadratic equation.

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.

13. Write a C program to print all the numbers from 99 to 1.

14. Write a C program to print the sum of first 'n' natural numbers.

15. Write a C program to find the factorial of a number.

16. Write a C program to check whether a given number is prime or not.

#include<stdio.h>

int main()

int i,n,sum=0;

printf("enter the number");

scanf("%d",&n);

for(i=2;i<n;i++)

if (n%i==0);{

printf("prime");
break;

else

printf("not");

return 0;

17. Write a C program to check whether a given number is armstrong or not.

18. Write a C program to reverse a given number and check whether it is a palindrome or not

19. Write a C program to print the following pattern:

* *

* * *

* * * *

20. Write a C program to print the following pattern: 1 1 2 1 2 3 1 2 3 4

21.Write a C program to print the following pattern:

2 2

3 3 3

4 4 44

22. Write a C program to print the following pattern: 1 2 3 4 5 6


23. Write a C program to print all the prime numbers from 1 to 'n'. Get the value of 'n' from the
user.

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! -.......

25. Write a C program to convert a decimal number to its binary representation

You might also like