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

c

The document contains two C programs. The first program calculates and prints the surface area and volume of a cylinder based on user-provided radius and height. The second program converts a temperature from Fahrenheit to Celsius and Kelvin, displaying the results to the user.

Uploaded by

suvarna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

c

The document contains two C programs. The first program calculates and prints the surface area and volume of a cylinder based on user-provided radius and height. The second program converts a temperature from Fahrenheit to Celsius and Kelvin, displaying the results to the user.

Uploaded by

suvarna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Q1.

Accept dimensions of a cylinder and print the surface area and volume (Hint:
surface area =2πr2 + 2πrh, volume = πr2h)
#include <stdio.h>

void main()
{
float radius, height;
float surface_area, volume;
printf("Enter value for radius and height of a cylinder : \n");
scanf("%f%f", &radius, &height);
surface_area = 2 * (22 / 7) * radius * (radius + height);
volume = (22 / 7) * radius * radius * height;
printf("Surface area of cylinder is: %f", surface_area);
printf("\n Volume of cylinder is : %f", volume);
}

Output:
Enter value for radius and height of a cylinder :
4
6
Surface area of cylinder is: 240.000000
Volume of cylinder is : 288.000000

Q2. C Program - Accept temperatures in Fahrenheit (F) and print it in Celsius (C)
and Kelvin (K)
#include<stdio.h>
void main()
{
float cel,fer,kel;

printf("Enter Temperature in Fahrenheit :");


scanf("%f",&fer);

cel= (fer-32)/1.8 ;
printf("Celsius = %f \n",cel);

kel = (fer-32)/1.8 + 273.15 ;


printf("Kelvin = %f \n",kel);

Output:
Enter Temperature in Fahrenheit :56
Celsius = 13.333333
Kelvin = 286.483337

You might also like