30 lines
949 B
C
30 lines
949 B
C
#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);
|
|
} |