Вы находитесь на странице: 1из 7

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

How to
convert days into years, weeks in C programming.

1 year = 365 days (Ignoring leap year)


1 week = 7 days

Example:
Input days: 373
Output = 1 year/s, 1 week/s and 1 day/s

2. Write a C program to input radius of a circle from user and find diameter, circumference and area of
circle. How to calculate diameter, circumference and area of a circle whose radius is given by user in C
programming.

Example:
Input radius: 10
Output diameter = 20 units
Output circumference = 62.79 units
Output area = 314 sq. units

Diameter of a circle can be expressed by formula: 2 * radius.


Circumference of a circle can be expressed by formula: 2 * π * radius.
Area of a circle can be expressed by formula: π * r2.

3. Write a C program to input length in centimeter from user and convert it to meter and kilometer. How to
convert length from centimeter to meter and kilometer in C programming. Length conversion program in
C from centimeter to meter and centimeter to kilometer.

Example:
Input length in centimeter = 1000
Output length in meter = 10 m
Output length in kilometer = 0.01 km

1 Meter = 100 Centimeter


1 Kilometer = 100000 Centimeter

4. Write a C program to input any two numbers x and y from user and find power of both number i.e. x^y
using inbuilt library pow() function. How to find power of two numbers in C programming. How to
use pow() function in C programming. C program to compute power of two numbers.

Example:
Input number1: 5
Input number2: 2
Output x^y = 25
5. Write a C program to input any number from user and find square root of the given number. How to
calculate square root of any number in C programming.

Example:
Input number: 9
Output: 3

Square root is a number which produces a specified quantity when multiplied by itself.

6. Write a C Program to input two angles of a triangle from user and find third angle of the triangle. How to
find all angles of a triangle if two angles are given by user using C programming. C program to calculate
the third angle of a triangle if two angles are given.

Example:
Input first angle: 60
Input second angle: 80
Output third angle: 40

We know that sum of all angles of a triangle is 180° i.e. a + b + c = 180° (Where a,b,c are angles of
triangles).

7. Write a C program to find maximum number between three numbers using if else. How to find maximum
or minimum between three numbers using if else in C programming. Finding maximum between three
numbers using if else in C program.

Example:
Input first number: 10
Input second number: 50
Input third number: 120
Output maximum: 120

8. Write a C program to check whether a character is alphabet or not using if else. How to check whether a
character is alphabet or not in C programming. Program to check character is alphabet or not in C.

Example:
Input character: a
Output: 'a' is alphabet

9. Write a C program to check whether an alphabet is vowel or consonant using if else. How to check
vowels and consonants using if else in C programming. Program to input a character from user and
check whether it is vowel or consonant in C.

Example:
Input character: a
Output: 'a' is vowel.
10. Write a C program to check whether a character is alphabet, digit or special character using if else. How
to check if a character is alphabet, digits or any other special character using if else in C programming.
Program to enter any character and check whether it is alphabet, digit or special character in C.

Example:
Input any character: 3
Output: 3 is a digit.

11. Write a C program to check whether a character is uppercase or lowercase alphabet using if else . How
to check uppercase and lowercase using if else in C programming. Program to enter a character from
user and check whether the character is uppercase or lowercase alphabet without using in built library
function.

C program to read a character from user and check whether the character is uppercase or lowercase
using inbuilt library functions.

Example:
Input character: C
Output: C is Uppercase alphabet

12. Write a C program to enter week number(1-7) and print the corresponding day of week name using if
else. How to print day of week using if else in C programming. Program to enter week number from user
and print day of week name using if else in C programming.

Example:
Input week number: 1
Output: Monday

13. Write a C program to enter month number between(1-12) and print the number of days in month using if
else. How to print total number of days in a given month using if else in C programming. Program to
enter month number from user and find number of days in month using if else in C.

Example:
Input month number: 1
Output: 31 days

14. Write a C program to check whether a triangle is equilateral, scalene or isosceles triangle using if else.
Program to enter sides of a triangle and classify triangle as Equilateral, Scalene or Isosceles triangle
using if else in C. How to check whether a triangle is equilateral, scalene or isosceles triangle in C
programming.
Example:
Input first side: 30
Input second side: 30
Input third side: 30
Output: Equilateral triangle

A triangle is Equilateral Triangle if all its sides are equal.


A triangle is Isosceles Triangle if its two sides are equal.
A triangle is Scalene Triangle if none of its sides are equal.
15. Write a C program to enter marks of five subjects Physics, Chemistry, Biology, Mathematics and
Computer, calculate percentage and grade according to following conditions:
Percentage > 90% : Grade A
Percentage > 80% : Grade B
Percentage > 70% : Grade C
Percentage > 60% : Grade D
Percentage > 40% : Grade E
Percentage < 40% : Grade F

16. Write a C program to enter any number from user and find the sum of all even numbers between 1 to n.
How to find sum of even numbers in a given range using loop in C programming. C program to find sum
of all even numbers in a given range.

Example:
Input upper limit to find sum: 10
Output sum of even numbers between 1 to 10: 30

17. Write a C program to print all odd numbers from 1 to 100 using for loop. How to display odd numbers
from 1 to n using loop in C programming. C program to print odd numbers in a given range.

Example:
Input upper limit to display odd numbers: 10
Output all odd numbers between 1 to 10: 1, 3, 5, 7, 9

18. Write a C program to print the sum of all odd numbers from 1 to n using for loop. How to find sum of all
odd numbers in a given number in C programming. Calculating sum of odd numbers in a given interval.

Example:
Input range: 10
Output sum of odd numbers from 1-10: 25

19. Write a C program to enter any number from user and print table of the given number using for loop.
How to print table of any given number in C programming. Table printing program in C.

Example:
Input number: 5
Output table of 5:
5*1=5
5 * 2 = 10
...
...
...
5 * 10 = 50
20. Write a C program to find the sum of all natural numbers between 1 to n using for loop. How to find sum
of natural numbers in a given range in C programming. C program to find sum of natural numbers withing
given interval using loop.

Example:
Input n: 10
Output sum of natural number 1-10: 55

21. Write a C program to enter a number from user and find first and last digit of number using loop. How to
find first and last digit of a number in C programming. Calculating first and last digit of any number using
loop in C programming.

Example:
Input number: 1234
Output first digit: 1
Output last digit: 4

22. Write a C program to read an integer from user and count total number of digits the integer contains.
How to find total number of digits in a given integer using loop in C programming. Logic to count number
of digits in a given integer using C program.

Example:
Input num: 35419
Output digits: 5

23. Write a C program to enter any number and calculate sum of digits of number using for loop. C program
to find sum of digits of a number. How to find sum of digits of a number in C programming.

Example:
Input any number: 1234
Output sum of digits: 1 + 2 + 3 + 4 = 10

24. Write a C program to enter any number from user and calculate product of its digits. How to find product
of digits of any number using loop in C programming. C program to find product of digits.

Example:
Input number: 1234
Output product of digits: 1 * 2 * 3 * 4 = 24

25. Write a C program to enter any number from user and find the reverse of given number using for loop.
How to find reverse of any number in C programming using loops. Program to find reverse of a given
number.

Example:
Input number: 1234
Output reverse: 4321
26. Write a C program to enter any number from user and print it into words using for loop. How to display
number in words using loops in C programming. C program to print decimal number to words.

Example:
Input: 1234
Output: One Two Three Four

27. Write a C program to print right triangle star(*) pattern series using for loop. How to print right triangle
star pattern series of n rows using for loop in C programming. The pattern with 5 rows should look like:

*
**
***
****
*****

28. Write a C program to print mirrored right triangle star(*) pattern series using for loop. How to print right
triangle star pattern series with trailing spaces of n rows using for loop in C programming. The pattern with 5
rows should look like:
*
**
***
****

29. Write a C program to print the equilateral triangle or Pyramid star(*) pattern series of n rows using for loop.
How to print Pyramid star pattern series using for loop in C programming. The pattern of 5 rows should look
like:
*
***
*****
*******
*********

30. Write a C 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
Test Data : 42
Expected Output : Its very hot.
31. Write a program in C to accept a grade and declare the equivalent description :

Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail

Input the grade : a


You have chosen : Average

32. Write a program in C to display the pattern like right angle triangle with number. Go to the editor
The pattern like :
1
12
123
1234
33. Write a program in C to make such a pattern like right angle triangle with number which will repeat a
number in a row.
The pattern like :
1
22
333
4444

34. Write a program in C that takes minutes as input, and display the total number of hours and minutes.
Expected Output :
Input minutes: 546
Output : 9 Hours, 6 Minutes

35. Write a C program that calculate the volume of a sphere.


Expected Output :
Input the radius of the sphere : 2.56
Output : The volume of sphere is 70.276237.

Вам также может понравиться