First Upload
This commit is contained in:
30
1/ex5.c
Normal file
30
1/ex5.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define TWO 2
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Exercise 5
|
||||
// ----------
|
||||
//
|
||||
// General : The program calculates right angled triangular area.
|
||||
//
|
||||
// Input : 2 ribs of the right angled triangle.
|
||||
//
|
||||
// Process : The program calculate rib * rib / 2.
|
||||
//
|
||||
// Output : The right angled triangular area.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Programmer : Cohen Idan
|
||||
// Student No : None
|
||||
// Date : 09.09.2019
|
||||
//---------------------------------------------------------------------------------------
|
||||
void main(void)
|
||||
{
|
||||
unsigned short rib1,
|
||||
rib2,
|
||||
area;
|
||||
printf("Enter 2 ribs of right angled triangle: ");
|
||||
scanf("%hd%hd", &rib1, &rib2);
|
||||
area = rib1 * rib2 / TWO;
|
||||
printf("The area is: %hd\n", area);
|
||||
}
|
||||
Reference in New Issue
Block a user