Lab Manual
Computer Engineering and Information Technology III Semester / ‘K’ Scheme
Prepared By K.ManiRaj M.Sc.,M.Phil., & P.Vinitha M.Sc M.Phil Lecturer, Department of CE/IT, M.S.P.V.L Polytechnic College, Pavoorchatram.
M.S.P.V.L Polytechnic College, Pavoorchatram Page 1
C and Data Structures Lab Manual
1A Celsius to Fahrenheit Conversion and vice versa
Aim:
To write a ‘C’ program to convert the given temperature in degree centigrade to Fahrenheit and vice versa.
Flow chart:
Start
Read C
F=9.0/5.0*c+32
Print F
Read F
C=5.0/9.0*(F-32)
Print C
Stop
M.S.P.V.L Polytechnic College, Pavoorchatram
Page 2
C and Data Structures Lab Manual
Algorithm:
1. Read the temperature in degree Centigrade. 2. Convert the Centigrade to Fahrenheit using the formula F=9/5*c+32 3. Print the Celsius and Fahrenheit value. 4. Read the temperature in degree Fahrenheit. 5. Convert the Fahrenheit to Centigrade using the formula C=5/9*(F-32) 6. Print the Fahrenheit and Celsius value. 7. Stop
Program:
/* Program to convert Centigrade to Fahrenheit and vice versa */ #include #include void main() { float c,f; clrscr(); /*To convert Centigrade to Fahrenheit*/ printf("Enter the temperature in centigrade:"); scanf("%f",&c); f=9.0/5.0*c+32; printf("\n\t%.2f Centigrade=%.2f Fahrenheit",c,f); /*To convert Fahrenheit to centigrade*/ printf("\n\nEnter the temperature in Fahrenheit:"); scanf("%f",&f); c=5.0/9.0*(f-32); printf("\n\t%.2f Fahrenheit=%.2f Centigrade",f,c); getch(); }
Output:
Enter the temperature in centigrade:45 45.00 Centigrade=113.00 Fahrenheit Enter the temperature in Fahrenheit:114
M.S.P.V.L Polytechnic College, Pavoorchatram
Page 3
C and Data Structures Lab Manual
114.00 Fahrenheit=45.56 Centigrade
1B
Aim:
Simple Interest and Compound Interest Calculation
To write a ‘C’ program to find the simple interest and Compound interest for the Amount