First Upload

This commit is contained in:
2022-02-25 15:33:16 +02:00
commit 0c74d10f0d
295 changed files with 74784 additions and 0 deletions

46
3/ex3.c Normal file
View File

@@ -0,0 +1,46 @@
#include <stdio.h>
#define TEN_THOUSAND 10000
#define ONE_HUNDRED 100
//---------------------------------------------------------------------------------------
// Exercise 3
// ----------
//
// General : The program print the date as a sentence.
//
// Input : 1 number.
//
// Process : The program take the year, month and day from the input and put in
// a sentence.
//
// Output : A sentence.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date : 19.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
int date,
temp_date;
short day,
month,
year;
printf("Enter date: ");
scanf("%d", &date);
temp_date = date;
year = temp_date - (temp_date / TEN_THOUSAND) * TEN_THOUSAND;
temp_date /= TEN_THOUSAND;
month = temp_date - (temp_date / ONE_HUNDRED) * ONE_HUNDRED;
temp_date /= ONE_HUNDRED;
day = temp_date;
printf("The year is %hd, the month is %hd, and the day is %hd\n", year, month, day);
}