Professional Documents
Culture Documents
Aditya K M
Aditya K M
NIT HAMIRPUR
BATCH-CSE
PERSONNEL
DETAILS
NAME- ADITYA KUMAR MEENA
COURSE- CSE (Btech ,4 year)
SECTION- E2
ROLL NO – 195107
a) Algorithm
#include<stdio.h>
#include<conio.h>
int main()
{
float a,b,avg;
printf("enter the first number");
scanf("%f",&a);
printf("enter the second number");
scanf("%f",&b);
avg=(a+b)/2;
printf("the average is %f",avg);
getch();
}
b) Pseudo Code
1- Start
2- Input a,b,avg
4- Output avg
5- Stop
c) Flow Chart
INPUT
START a,b,avg
OUTPU avg=(a+b)/
T avg 2
STOP
VARIABLES USED- a , b , avg
CONSTANT- 2
QUESTION- 2: TO FIND THE AREA OF
TRAPEZIUM
a) Algorithm
#include<stdio.h>
#include<conio.h>
int main()
{
float a,b,c,h;
printf("enter the parallel sides lengths");
scanf("%f%f",&a,&b);
printf("enter the height of trapezium");
scanf("%f",&h);
c=((a+b)*h)/2;
printf("the area of trapezium is %f",c);
getch();
}
b) PSEUDO CODE
1- Start
2- Input a , b , c , h
3- Compute c= ((a+b)*h)/2
4- Output c
5- Stop
C) FLOW CHART
INPUT a
,b,h,
START
c
C=
OUTPU
((a+b)*h)/2
Tc
STOP
VARIABLES USED- a , b , c ,
h
CONSTANTS- 2