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

9
1/PDF/debug.log Normal file
View File

@@ -0,0 +1,9 @@
[0909/152255.414:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/152314.222:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/152314.239:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/152314.267:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/152314.326:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/152314.336:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/152314.360:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/153314.223:ERROR:crash_report_database_win.cc(469)] failed to stat report
[0909/153314.223:ERROR:crash_report_database_win.cc(469)] failed to stat report

BIN
1/PDF/ex1.pdf Normal file

Binary file not shown.

BIN
1/PDF/ex2.pdf Normal file

Binary file not shown.

BIN
1/PDF/ex2_2.pdf Normal file

Binary file not shown.

BIN
1/PDF/ex3.pdf Normal file

Binary file not shown.

BIN
1/PDF/ex4.pdf Normal file

Binary file not shown.

BIN
1/PDF/ex5.pdf Normal file

Binary file not shown.

Binary file not shown.

BIN
1/ex1 Normal file

Binary file not shown.

50
1/ex1.c Normal file
View File

@@ -0,0 +1,50 @@
#include <stdio.h>
#define DIGITS 3
#define TEN 10
#define ZERO 0
//---------------------------------------------------------------------------------------
// Exercise 1
// ----------
//
// General : The program recognize if all digits are same.
//
// Input : Number with 3 digits.
//
// Process : The program summarizes all the digits and divie by last digit.
//
// Output : '0' if is it True, else is false.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date : 09.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
short num,
temp,
sum = ZERO;
printf("Enter number with 3 digits: ");
scanf("%hd", &num);
// Take the first digit from right and add to sum
temp = num / TEN;
sum += num - (temp * TEN);
num = temp;
temp = num / TEN;
sum += num - (temp * TEN);
num = temp;
sum += num;
// Divie the sum by last digit from right and check if (Rest == 0) and
// (result == (count of digits))
temp = sum / num;
sum %= num;
sum = sum + DIGITS - temp;
printf("If you got '0' then it is True, else is False: %hd\n", sum);
}

BIN
1/ex2 Normal file

Binary file not shown.

49
1/ex2.c Normal file
View File

@@ -0,0 +1,49 @@
#include <stdio.h>
#define TEN 10
#define ZERO 0
//---------------------------------------------------------------------------------------
// Exercise 2
// ----------
//
// General : The program change order digits - reverse order.
//
// Input : Number with 3 digits.
//
// Process : The program take the digits from right to left and multiplier the digit
// by 10.
//
// Output : Same number like input just reverse order.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date : 09.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
short num,
temp,
result = ZERO;
printf("Enter number with 3 digits: ");
scanf("%hd", &num);
// Take the first digit from right to left and add to result
temp = num / TEN;
result += num - (temp * TEN);
num = temp;
temp = num / TEN;
// Multiplie the result by 10
result *= TEN;
result += num - (temp * TEN);
num = temp;
temp = num / TEN;
result *= TEN;
result += num - (temp * TEN);
printf("%hd\n", result);
}

BIN
1/ex2_2 Normal file

Binary file not shown.

54
1/ex2_2.c Normal file
View File

@@ -0,0 +1,54 @@
#include <stdio.h>
#define TEN 10
#define ZERO 0
//---------------------------------------------------------------------------------------
// Exercise 2_2
// ------------
//
// General : The program change order digits - reverse order.
//
// Input : Number with 4 digits.
//
// Process : The program take the digits from right to left and multiplier the digit
// by 10.
//
// Output : Same number like input just reverse order.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date : 09.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
short num,
temp,
result = ZERO;
printf("Enter number with 4 digits: ");
scanf("%hd", &num);
// Take the first digit from right to left and add to result
temp = num / TEN;
result += num - (temp * TEN);
num = temp;
temp = num / TEN;
// Multiplie the result by 10
result *= TEN;
result += num - (temp * TEN);
num = temp;
temp = num / TEN;
result *= TEN;
result += num - (temp * TEN);
num = temp;
temp = num / TEN;
result *= TEN;
result += num - (temp * TEN);
printf("%hd\n", result);
}

BIN
1/ex3 Normal file

Binary file not shown.

59
1/ex3.c Normal file
View File

@@ -0,0 +1,59 @@
#include <stdio.h>
#define SIXTY 60
//---------------------------------------------------------------------------------------
// Exercise 3
// ----------
//
// General : The program calculates difference between 2 times.
//
// Input : 2 times by HH:MM:SS format.
//
// Process : The program coverts the hours and minutes to seconds and calculate
// the seconds by subtraction.
//
// Output : Time by format HH:MM:SS.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date : 09.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
short hours1,
minutes1,
hours2,
minutes2;
int seconds1,
seconds2;
printf("Enter the first time (HH:MM:SS): ");
scanf("%hd:%hd:%d", &hours1, &minutes1, &seconds1);
printf("Enter the second time (HH:MM:SS): ");
scanf("%hd:%hd:%d", &hours2, &minutes2, &seconds2);
// Change the hours to minutes
minutes1 += hours1 * SIXTY;
minutes2 += hours2 * SIXTY;
// Change the minutes to seconds
seconds1 += minutes1 * SIXTY;
seconds2 += minutes2 * SIXTY;
// Subtraction between times as seconds
seconds1 -= seconds2;
// Change the seconds to minutes
minutes1 = seconds1 / SIXTY;
// Rest for seconds
seconds1 %= SIXTY;
// Change the minutes to hours
hours1 = minutes1 / SIXTY;
// Rest for minutes
minutes1 %= SIXTY;
printf("%02hd:%02hd:%02d\n", hours1, minutes1, seconds1);
}

BIN
1/ex4 Normal file

Binary file not shown.

26
1/ex4.c Normal file
View 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);
}

BIN
1/ex5 Normal file

Binary file not shown.

30
1/ex5.c Normal file
View 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);
}

BIN
1/test Normal file

Binary file not shown.

9
1/test.c Normal file
View File

@@ -0,0 +1,9 @@
#include <stdio.h>
void main(void)
{
short num = 2;
num = !-2;
printf("%hd", num);
}