following is program to calculate the area of triangr which is bit similer to the previous prog add substract etc.
- code with user input:-
#include<iostream.h>
void main()
{
int a,b;
float c;
cout<<"enter the value of a&b";
cin>>a>>b;
c=1/2*b*h;
cout<<"Area of triangle="<<c;
}
- code without user input:-
#include<iostream.h>
void main()
{
int a,b;
float c;
a=17;
b=12;
c=1/2*b*h;
}
note:-it's just a sudo code if its not executing on your device make some changes in the further code this is only for understanding logic.
above is the prog for the area of triangle we can make for circle, rectangle and any other by just changing the formula.
thankyou for visiting us stay tuned for learning and more intresting u can ask questions in comment section check other blogs for more info. comment mail for compitative cading thankyou.👍😎🙏
0 Comments