Starting Vocational Training From 1-May-2024 Get Detail


C language

If Else and Nesting Based Question
1.

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


Solution
2.

Write a C program to find the largest of three numbers.


Solution
3.

Write a C program to check whether a given number is even or odd.
Test Data : 15
Expected Output :
15 is an odd integer


Solution
4.

Write a C program to accept two integers and check whether they are equal or not.


Solution
5.

Write a C program to convert a given integer (in seconds) to hours, minutes and seconds.
Test Data :
Input seconds: 25300
Expected Output:
There are:
H:M:S - 7:1:40


Solution
6.

Write a C program to convert a given integer (in days) to years, months and days, assumes that all months have 30 days and all years have 365 days.
Test Data :
Input no. of days: 2535
Expected Output:
6 Year(s)
11 Month(s)
15 Day(s)


Solution
7.

Write a C program that reads three floating values and check if it is possible to make a triangle with them. Also calculate the perimeter of the triangle if the said values are valid. 
Test Data :
Input the first number: 25
Input the second number: 15
Input the third number: 35
Expected Output:
Perimeter = 75.0


Solution
8.

Write a C program that reads two integers and checks if they are multiplied or not. 
Test Data :
Input the first number: 5
Input the second number: 15
Expected Output:
Multiplied!


Solution
9.

Write a C program that reads an integer between 1 and 12 and print the month of the year in English.
Test Data :
Input a number between 1 to 12 to get the month name: 8
Expected Output:
August


Solution
10.

Write a C program that read 5 numbers and counts the number of positive numbers and print the average of all positive values. 
Test Data :
Input the first number: 5
Input the second number: 8
Input the third number: 10
Input the fourth number: -5
Input the fifth number: 25
Expected Output:
Number of positive numbers: 4
Average value of the said positive numbers: 12.00


Solution
11.

Write a C program to check a given integer is positive even, negative even, positive odd or negative odd. Print even if the number is 0. 
Test Data :
Input an integer: 13
Expected Output:
Positive Odd


Solution
12.

Write a C program to remove any negative sign in front of a number.


Solution