8

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

8.

Write a program to input length and width of a rectangle and calculate perimeter and area of the
rectangle.

9. Write a program to input radius of a circle from user and find diameter, circumference and area
of the circle.

10. Write a program to input a positive integer N with 2 digits from the keyboard, output to the
screen the sum of the digits of N.

Ex: Input: N=48. Output: 4+8=12.

11. Write a program to input temperature in degrees Celsius and convert to Fahrenheit, using the
conversion formula:

12. Write a program that allows input hours, minutes and seconds and convert it to seconds and
print the result.

Ex: Input: h=1, m=2, s=2. Output: 3722 seconds.

13. Write a program in C that takes minutes as input, and display the total number of hours and
minutes

14. Write a program to input number of days from user and convert it to years, weeks and days.

Ex: Input: Enter days: 373.

Output: Years: 1

Weeks: 1

Days: 1

15. Write a program to enter length in centimeter and convert it into meter and kilometer.

16. Write a program to calculate the perimeter and area of shapes: triangles, squares, rectangles
and circles with the information that needs to be entered from the keyboard.

17. Write a program to enter two integers a and b. Print the maximum value to the screen.
18. Write a program to check whether an integer entered number by the user is odd or even.

19. Write a program to check number is positive, negative or zero.

20. Write a program to find the largest number among three number.

20b. Write a program to enter two integers a,b and c. Print the maximum value to the screen.

21. Write a program input three numbers a,b,c. Print to the screen in ascending order of numbers.

22. Write a program to find input two numbers a, b. Find the largest number using Conditional
Operator.

23. Write a C program to find whether a given year is a leap year or not.

(A leap year is a year that is divisible by 4 and not by 100. Or it is divisible by 400)

Ex: Enter year : 2016

Output : 2016 is a leap year.

23b. Write a C program to find whether a given year is a leap year or not.

(A leap year is a year that is divisible by 4 and not by 100. Or it is divisible by 400)

Ex: Enter year : 2024

Output : 2024 is a leap year.

24. Write a program to solve the linear equation of one variable: ax + b = 0.

25. Write a program to solve quadratic equation : ax2 + bx + c = 0.

26. Write a program to read temperature in centigrade and display a suitable message according to
temperature state below:

Temp < 0 then Freezing weather

Temp 0-10 then Very Cold weather

Temp 10-20 then Cold weather

Temp 20-30 then Normal in Temp

Temp 30-40 then Its Hot

Temp >=40 then Its Very Hot

27. Write a program to input a three-digit integer n. Output to the screen in ascending order of
digits.
Ex: Enter n : 291

Output : 129

28. Write a program in C to read any day number in integer (2….8) and display day name in the
week

Ex: Input : 4

Output :Wednesday

29. Write a C program to input an alphabet and check whether it is vowel or consonant using switch
case

Ex: Input alphabet: c

Output : 'c' is consonant

30. Write a C program to create menu driven calculator that performs basic arithmetic operations
(add, subtract, multiply and divide) using switch case and functions. The calculator should input two
numbers and an operator from user. It should perform operation according to the operator entered and
must take input in given format.

Ex: Input: 5.2 – 3

Output : 2.2

1.1 Calculate: n! (n>0)

1.2 Calculate: S(n)=1+3+5+⋯.+(2×n+1), n≥0

1.3 Calculate: P(n)=1.3.5…(2.n+1), n≥0

1.4 Calculate: S(n)=1+1.2+1.2.3+⋯+1.2.3….n, n>0)

1.5 Calculate: S(n)=1-2+3-4+⋯+(-1)^(n+1) n, n>0

1.6 Calculate: S(n)=1+1/2+1/3+⋯+1/n, n>0

Write a program to count the number of divisors of a positive integer N.

Ex: Enter n : 12
Output : 6

38. Write a C program to input two or more numbers from user and find maximum and minimum of
the given numbers using functions.

39. Write a C program to input a positive integer n. Find the sum of it’s divisors.

40. Write a C program to input a positive integer n. Print all divisors of n.

41. Write a program to input a positive integer n. Checks whether n is prime or not.

42. Write a program to input a positive integer n. Find the sum of prime less than n.

43. Write a function in C programming to find prime numbers between two intervals using function.

44. Write a program to input two positive integers a and b. Find the greatest common divisor and
least common multiple of a and b.

45. Write a program in C to swap two numbers using a function.

46. Write a program in C to convert a decimal number to a binary number using the function.

47. Write a program in C to check whether a number is “perfect numbers” or not using the function.

(Perfect numbers: a perfect number is a positive integer that is equal to the sum of its positive divisors,
excluding the number itself)

Ex: 6 = 1+2+3 (6 is perfect number)

28=1+2+4+7+14 (28 is perfect number)

48. Write a C program to input a positive integer n. Print all “perfect numbers” less than n.

54.a Write a program in C to print all even numbers in array.

55.a Write a program in C to print all odd numbers in array.

54.b Write a program in C to print all negative numbers in array.

55.b Write a program in C to print all positive numbers in array.

56. Write a program in C to print all prime numbers in array.

57. Write a program in C to print all perfect numbers in array.

You might also like