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

lab report

This document contains three C programming assignments submitted by Siam Khan. The first program converts Celsius to Fahrenheit, the second calculates the circumference of a circle based on user input, and the third computes the area of a triangle using the base and height provided by the user. Each program includes code snippets and prompts for user input.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

lab report

This document contains three C programming assignments submitted by Siam Khan. The first program converts Celsius to Fahrenheit, the second calculates the circumference of a circle based on user input, and the third computes the area of a triangle using the base and height provided by the user. Each program includes code snippets and prompts for user input.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab Assignment

Submitted By
Name : Siam Khan
ID : 0432410005081039
1. Convert and Print Celsius Temperature to Fahrenheit

#include <stdio.h>
int main() {
float celsius, fahrenheit;
printf("Enter temperature in Celsius: ");
scanf("%f", &celsius);
fahrenheit = (celsius * 9 / 5) + 32;
printf("%f C = %f F\n", celsius, fahrenheit);

return 0;
}

Output :
2. Write a program in C to find the circumference of a circle using
user input

#include <stdio.h>
int main() {
float radius, circumference , PI = 3.1416;

printf("Enter the radius of the circle: ");


scanf("%f", &radius);

circumference = 2 * PI * radius;

printf("The circumference of the circle is : %f", circumference);

return 0;
}

Output :
3. Write a program in C to find the area of at triangle using user input

#include <stdio.h>

int main() {
float base, height, area;

printf("Enter the base of the triangle: ");


scanf("%f", &base);

printf("Enter the height of the triangle: ");


scanf("%f", &height);

area = 0.5 * base * height;

printf("The area of the triangle is: %.2f\n", area);

return 0;
}

Output :

You might also like