CVM Computer Programming with C
Practical-2
Write a program to find area of triangle(a=h*b*.5)
a = area,h = height,b = base
Logic to find area of a triangle
Below is the step by step descriptive logic to find area of a triangle.
- Input base of the triangle. Store in some variable say b(base).
- Input height of the triangle. Store in some variable say h(height).
- Use triangle area formula to calculate area i.e.
a = b * h * 05
- Print the resultant value of area.
Solution
Output
Write a program to calculate simple interest (i = (p*r*n)/100 )
i = Simple interest
p = Principal amount
r = Rate of interest
n = Number of years
Logic to calculate simple interest
Step by step descriptive logic to calculate simple interest.
- Input principle amount in some variable say p(principle)
- Input years in some variable say n(years).
- Input rate in some variable say r(rate).
- Find simple interest using formula
I =( p * r * n) / 100 )
. - Finally, print the resultant value of I(intrest).
Solution
Output
0 Comments