EmbLogic's Blog

Area of Triangle or Square

1 #include <stdio.h>
2 int main()
3 {
4         int side, base, height,choice,AOT,AOS;
5         printf(“enter side\n”);
6         scanf(“%d”, &side);
7         printf(“enter base\n”);
8         scanf(“%d”, &base);
9         printf(“enter height\n”);
10         scanf(“%d”, &height);
11         printf(“1=AOT\n”);
12         printf(“2=AOS\n”);
13         scanf(“%d”,&choice);
14         switch(choice)
15         {
16                 case 1: AOT=(base*height)/2;
17                 printf(“%d”, AOT);
18                 break;
19                 case 2: AOS=side*side;
20                 printf(“%d”, AOS);
21                 break;
22                 }
23                 return 0;
24         }
~

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>