1-10 Exp Ip Correct
1-10 Exp Ip Correct
1-10 Exp Ip Correct
# include <stdio.h>
int main()
{
//Simple interset program
int P, R, T;
float SI;
printf("Enter the principal: ");
scanf("%d", &P);
printf("Enter the rate: ");
scanf("%d", &R);
printf("Enter the time: ");
scanf("%d", &T);
SI = (P * R * T) / 100;
printf("The Simple interest is %f", SI);
return 0;
}
Output:
Enter the principal: 12000
Enter the rate: 10
Enter the time: 3
The Simple interest is 3600.000000
root = sqrt(num);
printf("The Square Root of %f is %f.", num, root);
return 0;
}
Output:
Enter an integer: 36
The Square Root of 36.000000 is 6.000000.
6. Finding compound interest
Aim: Write a C program to find compound interest
Program:
#include <stdio.h>
#include <math.h>
int main()
{
float p, r, t, ci;
printf("Enter the principle :");
scanf("%f", &p);
printf("Enter the rate :");
scanf("%f", &r);
printf("Enter the time :");
scanf("%f", &t);
ci = p * pow((1 + r / 100), t) - p;
return 0;
}
Output:
Enter the principle :12000
Enter the rate :12
Enter the time :3
The compound interest is 4859.14
7. Area of a triangle using heron’s
formulae
Aim: Write a C program to find Area of a
triangle using heron’s formulae
Program:
#include<stdio.h>
#include<math.h>
int main()
{
float a, b, c, s, area;
printf("\nEnter three sides of triangle\
n");
scanf("%f%f%f",&a,&b,&c);
s = (a+b+c)/2;
//Calculate area of triangle
area = sqrt(s*(s-a)*(s-b)*(s-c));
return 0;
}
Output:
Enter three sides of triangle
563
Area of triangle: 7.483315
8. Distance travelled by an object
Aim: Write a C program to find Distance travelled by an object.
Program:
#include<stdio.h>
int main() {
float u, a, d;
int t;
d = (u * t) + (a * t * t) / 2;
return 0;
}
Output:
Enter the value of a : 3
Enter the value of u : 5
Enter the value of t : 2
The Distance : 16.00
9. Evaluate the following expressions.
a. A+B*C+(D*E) + F*G
b. A/B*C-B+A*D/3
c. A+++B---A
d. J= (i++) + (++i)
void main()
{
int a, b, c, big ;