Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Question (2.

1)
#include <stdio.h>

int main()
{
int a,b,c;
printf("enter 3 numbers ");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c){
printf("a is the largest number = %d",a);
}else if(b>a && b>c){
printf("b is the largest number = %d ",b);
}else
printf("c is the largest number = %d ",c);

return 0;
}

Question (2.2)
#include <stdio.h>

int main()
{
int a,b,c;
printf("enter 3 numbers to check if angle is right angle triangle ");
scanf("%d%d%d",&a,&b,&c);
if(a+b+c==90)
printf("triangle is right angle triangle");
else
printf("not right angle triangle");

return 0;
}

Question (1.3)

Step 1: reading of car odometer is S kilometers (input).


Step 2: fuel tank is full (input).
Step 3:after the journey the reading is F
Step 4:to calculate total distance S – F;
Step 5: output total distance
Step 6:to calculate total consumption of fuel tank – L
Step 7: output total consumption of fuel is F-L

You might also like