#include<stdio.h>
#include<conio.h>
#define p printf
#define jee scanf
int main()
{
int peri, s1, s2, s3, base, height;
char choice;
float area;
p("What do you want to solve?");
p("\nP - Perimeter \nA - Area");
p"\nEnter choice: ");
s(%s",&choice);
switch(choice)
{
case 'P':
{
p(Enter side #1: ");
s(%d",&s1);
p(Enter side #2: ");
s(%d",&s2);
p(nter side #3: ");
s(%d",&s3);
peri = s1 + s2 + s3;
p(The perimeter of the triangle is %d",peri);
break;
}
case 'A':
{
p"Enter base: ");
s(%d",&base);
p(Enter height: ");
s(%d",&height);
area = (base * height)*.5;
p(The area of the triangle is %.2f",area);
break;
}
}
getch ();
return 0;
}
No comments:
Post a Comment