You are on page 1of 5

Write a C program to find the area and circumference of a

circle. (Use PI as a symbolic constant).

#include <stdio.h>
#define PI 3.14
int main()
{
float a,r,pi,cir;
//#include<stdio.h>
#define PI 3.14
int main()
{
float rad, cir, area;
printf("Enter Radius Value of Circle: ");
scanf("%f", &rad);
//area = 3.14*rad*rad;
//cir = 2*3.14*rad;
area = PI*rad*rad;
cir = 2*PI*rad;
printf("\nArea = %0.2f", area);
printf("\nArea = %0.2f", cir);

return 0;
}
Write a C Program to find area and perimeter of a Triangle

#include<stdio.h>
#include<math.h>
int main()
{
float a, b, c, Perimeter, s, Area;

printf("\nPlease Enter three sides of triangle\n");


scanf("%f%f%f",&a,&b,&c);

Perimeter = a+b+c;
s = (a+b+c)/2;
Area = sqrt(s*(s-a)*(s-b)*(s-c));

printf("\n Perimeter of Traiangle = %.2f\n", Perimeter);

printf("\n Area of triangle = %.2f\n",Area);


// area = (0.5 * b * h);

return 0;
}
Write a C program to convert Celsius to
Fahrenheit
#include <stdio.h>

int main()
{
float celsius, fahrenheit;

printf("Please Enter temperature in Celsius: \n");


scanf("%f", &celsius);

// Convert the temperature from celsius to fahrenheit


fahrenheit = ((celsius * 9)/5) + 32;
// fahrenheit = ((9/5) * celsius) + 32;
// fahrenheit = ((1.8 * celsius) + 32;

printf("\n %.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);

return 0;
}
Lab Report
1. Write a C program to find area and
circumference of a circle (Use  as a symbolic
constant).
2. Write a C program to find area and perimeter
of a triangle (three sides of triangle are given).
3. Write a C program to find area and perimeter
of a rectangle.
4. Write a C program to convert the given
temperature in Fahrenheit to Celsius.
Rules for writing Lab Report
1. Exp no.
2. Exp Name
3. Objectives
4. Algorithm
5. Source Code
6. Sample Input/Output
7. Discussion
NB. You must submit lab report in handwriting .Only front page is printed. (if
necessary, contact with group : P

You might also like