-->

program to get area of parallelogram

//program to get area of parallelogram
#include<stdio.h>
#include<conio.h>
void main()
{
float base,height;
float area;
printf(“enter base and height of parallelogram\n”);
scanf(“%f%f”,&base,&height);
area=base*height;
printf(“the area is=%f\n”,area);
getch();
}

program to get simple interest and amount

//program to get simple interest
#include<stdio.h>
#include<conio.h>
void main()
{
float p,r,t;
float interest,A;
printf("enter principal,rate of interest and time\n");
scanf("%f%f%f",&p,&r,&t);
interest=(p*t*r)/100;
A=p+interest;
printf("the interest gained is=%f\n",interest);
printf("the amount after interest=%f\n",A);
getch();
}

Solution6



// program to get ‘v’ using given formula v2=u2+2as
#include<stdio.h>
#include<conio.h>
#include<math.h> //for sqrt() and pow() function
void main()
{
float u,a,s;
float v;
printf(“enter  value of ‘u’\n”);
scanf(“%f”,&u);
printf(“please enter value of ‘s’\n”);
scanf(“%f”,&s);
printf(“please enter value of ‘a’\n”);
scanf(“%f”,&a);
v=sqrt(pow(u,2)+2*a*s);
printf(“the value of 'v'=%f\n”,v);
getch();
}

solution5

// program to get ‘S’ using given formula
#include<stdio.h>
#include<conio.h>
void main()
{
float u,t,a;
float s;
printf(“enter  value of ‘u’\n”);
scanf(“%f”,&u);
printf(“please enter value of ‘t’\n”);
scanf(“%f”,&t);
printf(“please enter value of ‘a’\n”);
scanf(“%f”,&a);
s=u*t+(1.0/2.0)*a*t*t;
printf(“the value=%f\n”,s);
getch();

}

solution4

// program to get area of triangle
#include<stdio.h>
#include<conio.h>
void main()
{
float base,height;
float area;
printf(“enter base and height of triangle\n”);
scanf(“%f%f”,&base,&height);
area=0.5*base*height;
printf(“the area is=%f\n”,area);

getch();
}

solution3


// program to get volume of sphere
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float radius;
float volume;
printf(“enter radius of sphere\n”);
scanf(“%f”,&radius);
volume=4.0*3.14*(pow(r,3))/3.0;   // the pow() function exits inside "math.h"
printf(“the volume is=%f\n”,volume);
getch();
}

you did not understand how it works! follow the “C” learning part/section (coming soon).

solution2


// program to get area and perimeter of rectangle
#include<stdio.h>
#include<conio.h>
void main()
{
float l,b;
float area,perimeter;
printf(“enter length and breadth of rectangle\n”);
scanf(“%f%f”,&l,&b);
area=l*b;
perimeter=2*(l+b);
printf(“the area is=%f\n”,area);
printf(“the perimeter=%f\n”,perimeter);
getch();
}
you did not understand how it works! follow the “C” learning part/section (coming soon).