#include<stdio.h>
#include<conio.h>
#define min printf
#define jee scanf
int main()
{
int peri, s1, s2, s3, base, height;
char choice;
float area;
min("What do you want to solve?");
min("\nP - Perimeter \nA - Area");
min("\nEnter choice: ");
jee("%s",&choice);
switch(choice)
{
case 'P':
{
min("Enter side #1: ");
jee("%d",&s1);
min("Enter side #2: ");
jee("%d",&s2);
min("Enter side #3: ");
jee("%d",&s3);
peri = s1 + s2 + s3;
min("The perimeter of the triangle is %d",peri);
break;
}
case 'A':
{
min("Enter base: ");
jee("%d",&base);
min("Enter height: ");
jee("%d",&height);
area = (base * height)*.5;
min("The area of the triangle is %.2f",area);
break;
}
}
getch ();
return 0;
}
Sample Outputs:
▌▌▌Ü ▌▌▌
Walang komento:
Mag-post ng isang Komento