Doc2
Doc2
Experiment Name:
Calculating area and perimeter of a rectangle in C.
Objective:
To write a C program that calculates and displays the area and perimeter of a rectangle,
taking the length and width as input from the user.
Software Required
Computer system
C compiler (GCC, Turbo C++)
Text editor (Notepad++, Visual Studio Code, Codeblocks)
Flow Chart
Algorithm:
Step 1: Start.
area = length*width;
Step 7: End.
Source code:
#include <stdio.h>
int main() {
scanf("%d", &length);
scanf("%d", &width);
units\n", area);
units\n", perimeter);
return 0;
}
Output:
Lab Report 02
Experiment Name:
Objective:
To write a C program that calculates the area and circumference of a circle using a
symbolic constant for the value of pi.
Software Required:
Computer system
C compiler (GCC, Turbo C++)
Text editor (Notepad++, Visual Studio Code, Codeblocks)
Algorithm:
Step 1: Start.
area=PI*radius*radius;
circumference = 2*PI*radius
Step 7: End.
Source code:
#include <stdio.h>
#define PI 3.1416
int main() {
float radius, area, circumference;
Experiment Name:
Objective:
To write a C program that calculates the area and circumference of a triangle using the
given three sides of the triangle.
Software Required:
Computer system
C compiler (GCC, Turbo C++)
Text editor (Notepad++, Visual Studio Code, Codeblocks)
Algorithm:
Step 1: Start.
Step 8: End.
Source code:
#include <stdio.h>
#include <math.h>
int main() {
float side1, side2, side3, s, area, perimeter;
Experiment Name:
Objective:
To write, compile, and execute a C program to calculate the sum of three numbers
entered by the user.
Software Required:
Computer system
C compiler (GCC, Turbo C++)
Text editor (Notepad++, Visual Studio Code, Codeblocks)
Algorithm:
Step 1: Start.
Step 6: End.
Source code:
#include <stdio.h>
int main() {
return 0;
}
Output:
Lab Report 05
Experiment Name:
Objective:
To write and execute a C program that converts a given temperature in Celsius to its
equivalent value in Fahrenheit.
Software Required:
Computer system
C compiler (GCC, Turbo C++)
Text editor (Notepad++, Visual Studio Code, Codeblocks)
Algorithm:
Step 1: Start.
Step 6: End.
Source code:
#include <stdio.h>
#include <stdio.h>
int main() {
scanf("%f", &celsius);
return 0;
}
Output:
Lab Report 06
Experiment Name:
Objective:
To write and execute a C program that converts a given temperature in Celsius to its
equivalent value in Fahrenheit.
Software Required:
Computer system
C compiler (GCC, Turbo C++)
Text editor (Notepad++, Visual Studio Code, Codeblocks)
Algorithm:
Step 1: Start.
Step 6: End.
Source code:
#include <stdio.h>
int main() {
scanf("%f", &fahrenheit);
return 0;
}
Output: