write a program segment that will ask the user if he wants
to computer the perimeter of the area of the triangle. if
the perimeter is wanted, ask the measure of the three sides
and compute for the perimeter. if the area is wanted, ask
for the measures of the base and height and compute for the
area. display the computed value



write a program segment that will ask the user if he wants to computer the perimeter of the area o..

Answer / shayne delos santos

#include<stdio.h>
#include<conio.h>


int choice,p,a,b,c,area,base, height;


int main()
{
p("This program will get the perimeter and are of Triangle\n");
p("Choices\n");
p("1.] Perimeter\n");
p("2.] Area\n");
p("Enter Choice [1 or 2]: ");
s("%d",&choice);


if (choice == 1)
{
p("Enter Side A: ");
s("%d",&a);
p("Enter Side B: ");
s("%d",&b);
p("Enter Side C: ");
s("%d",&c);
p = a + b + c;
p("The perimeter of the area of a triangle is %d",p);
}


if (choice == 2)
{
p("Enter Base: ");
s("%d",&base);
p("Enter Height: ");
s("%d",&height);
area = (base * height)/2;
p("The area of a triangle is %d",area);
}
getch();
return 0;
}

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More JavaScript Code Interview Questions

determine which key was pressed and its type

1 Answers  


how to copy form data between different pages

0 Answers  


code to get the coordinates of a Click Event

0 Answers  


sample code to auto focusing the first field in a form

0 Answers   Wipro,


i am making a purchase sheet in html ,it contain names of product(by selecting checkboxes),quantity(textbox) and price(checbox), by using java script i am restricting the user to prevent them to enter the wrong data ,so i made the servlet were i am only able to prevent them to enter the page in empty field , so my doubt is how do you prevent them how to enter non numerical data in quantity field

2 Answers   Infosys,






how to pass data between pages using Frames

0 Answers  


write a program segment that will ask the user if he wants to computer the perimeter of the area of the triangle. if the perimeter is wanted, ask the measure of the three sides and compute for the perimeter. if the area is wanted, ask for the measures of the base and height and compute for the area. display the computed value

1 Answers  


code to keep a page Out of the browser history

0 Answers  


how to create a Custom Scrollbar

0 Answers  


<html> <head> <title>BASIC CALCULATOR</title> </head> <script language= "javascript"> function= setValue(){ var a_term1 </script> <body> <center> <table> <tr> <td><input type="text" id="text box1" style="width:50px"> </td> <td><input type="text" id="text box2" style="width:40px"> </td> <td><input type="text" id="text box3" style="width:50px"> </td> </tr> </table> <table> <tr> <td><input type="text" id="text box4" ></td> </tr> </table> <table> <tr> <td><input type= "button" value= "7" onClick="" ></td> <td><input type= "button" value= "8" onClick="" ></td> <td><input type= "button" value= "9" onClick="" ></td> <td><input type= "button" value= "/" onClick="" ></td> </tr> <td><input type= "button" value= "4" onClick="" ></td> <td><input type= "button" value= "5" onClick="" ></td> <td><input type= "button" value= "6" onClick="" ></td> <td><input type= "button" value= "*" onClick="" ></td> </tr> <td><input type= "button" value= "1" onClick="" ></td> <td><input type= "button" value= "2" onClick="" ></td> <td><input type= "button" value= "3" onClick="" ></td> <td><input type= "button" value= "-" onClick="" ></td> </tr> <td><input type= "button" value= "0" onClick="" ></td> <td><input type= "button" value= "C" onClick="" ></td> <td><input type= "button" value= "=" onClick="" ></td> <td><input type= "button" value= "+" OnClick="" ></td> </table> </center> </body> <hr/> </html> how do i make the calculator work now

1 Answers  


code to images to rollover

0 Answers  


code to sorting an array of objects

0 Answers  


Categories
  • PHP Code Interview Questions PHP Code (33)
  • JSP Code Interview Questions JSP Code (6)
  • ASP Code Interview Questions ASP Code (5)
  • CGI Perl Code Interview Questions CGI Perl Code (3)
  • JavaScript Code Interview Questions JavaScript Code (63)
  • VB Script Code Interview Questions VB Script Code (20)
  • Shell Script Code Interview Questions Shell Script Code (31)
  • Python Code Interview Questions Python Code (34)
  • WinRunner Code Interview Questions WinRunner Code (1)
  • HTML DHTML XHTML Code Interview Questions HTML DHTML XHTML Code (13)
  • XML Interview Questions XML (43)
  • Scripts_Markup Code AllOther Interview Questions Scripts_Markup Code AllOther (5)