First Upload
This commit is contained in:
26
1/ex4.c
Normal file
26
1/ex4.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#define APPLE_COUNT 10
|
||||
#define APPLE_COST 5
|
||||
#define TWO 2
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Exercise 4
|
||||
// ----------
|
||||
//
|
||||
// General : The program calculates what is the cost for bananas and apples.
|
||||
//
|
||||
// Input : None.
|
||||
//
|
||||
// Process : The program calculate price by multiply and amount.
|
||||
//
|
||||
// Output : None.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Programmer : Cohen Idan
|
||||
// Student No : None
|
||||
// Date : 09.09.2019
|
||||
//---------------------------------------------------------------------------------------
|
||||
void main(void)
|
||||
{
|
||||
unsigned char bananas = APPLE_COUNT + TWO;
|
||||
unsigned short sum_cost = (APPLE_COUNT * APPLE_COST) +
|
||||
(bananas * APPLE_COST * TWO);
|
||||
}
|
||||
Reference in New Issue
Block a user