0% found this document useful (0 votes)
40 views

C Programming First Practical Assignment

1. Write a program that initializes two variables to 50.8 and 21.2 respectively and displays their sum. 2. Write a program that initializes a radius variable to 6.5 and displays the area of a circle with that radius. 3. Write a program that initializes a radius variable to 5.5, a height variable to 6, and displays the volume of a cylinder with those dimensions. 4. The programs ask the user for input like age, numbers, etc and perform calculations like addition, subtraction, multiplication, division etc on the input and display the output.

Uploaded by

Iam Bunny
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

C Programming First Practical Assignment

1. Write a program that initializes two variables to 50.8 and 21.2 respectively and displays their sum. 2. Write a program that initializes a radius variable to 6.5 and displays the area of a circle with that radius. 3. Write a program that initializes a radius variable to 5.5, a height variable to 6, and displays the volume of a cylinder with those dimensions. 4. The programs ask the user for input like age, numbers, etc and perform calculations like addition, subtraction, multiplication, division etc on the input and display the output.

Uploaded by

Iam Bunny
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

C PROGRAMMING FIRST PRACTICAL ASSIGNMENT

1. write a c program that initializes two variables to 50.8 and 21.2 respectively and displays
their sum.

2. write a c program that initializes a radius of the circle to 6.5 displays the area.

3. write a c program that initializes a radius of the cylinder to 5.5 and the height to 6 and
displays the volume of the cylinder.
GETTING THE INPUT FROM The User using scanf() function

4. Write a c program that asks the user to type his/her age and then displays his/her age.
5. write a c program that asks the user to enter two numbers and displays their product.
6. Write a C program that converts Centigrade to Fahrenheit
Expected Output:
Input a temperature (in Centigrade): 45
113.000000 degrees Fahrenheit.
7. Write a C program that calculates the volume of a sphere.
Expected Output:
Input the radius of the sphere: 2.56
the volume of sphere is 70.276237.
8. Write a C program that takes the height and width as input and prints the perimeter of a
rectangle.
Expected Output :
Input the height of the Rectangle : 5
Input the width of the Rectangle : 7
Perimeter of the Rectangle is : 24.000000
9. Write a C program that converts kilometers per hour to miles per hour
Expected Output:
Input kilometres per hour: 15
9.32057 miles per hour
10. Write a C program that takes hours and minutes as input, and calculates the total number
of minutes.
Expected Output:
Input hours: 6
Input minutes: 40
Total: 400 minutes.

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

12. Write a program in C that reads a firstname, surname and year of birth and display the
names and the year one after another sequentially.
Expected Output :
Input your firstname: Tom
Input your lastname: Davis
Input your year of birth: 1982
Tom Davis 1982

13. Write a program in C that takes input of three numbers separated by a comma, and
calculates their sum.
Expected Output :
Input three numbers separated by comma : 2,5,3
The sum of three numbers : 10

14. Write a program in C that takes input of two numbers from the user, and performs
addition, subtraction, multiplication and division:
Expected Output :
Input any two numbers separated by comma : 5,2
The sum of the given numbers : 7
The difference of the given numbers : 3
The product of the given numbers : 10
The quotient of the given numbers : 2.500000
15. Write a program in C that takes input of two angles of a triangle from the user, and
calculates the third angle:
Expected Output:
Input first angle of the triangle: 80
Input second angle of the triangle: 30
Third angle of the triangle: 70

You might also like