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

44
3/ex2_7.c Normal file
View File

@@ -0,0 +1,44 @@
#include <stdio.h>
#define ONE 1
#define TWO 2
//---------------------------------------------------------------------------------------
// Exercise 2_7
// ------------
//
// General : The program change letters by one depends on situation.
//
// Input : 2 letters.
//
// Process : The program checks if the first letter is before the second in
// the ABC and acts accordingly.
//
// Output : '1' if is it True, '0' is false.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date : 19.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
char a,
b,
final_a,
final_b,
opr = '+';
printf("Enter 2 chars: ");
scanf("%c%c", &a, &b);
final_a = a + ONE;
final_b = b - ONE;
if (a > b)
{
final_a -= TWO;
final_b += TWO;
opr = '-';
}
printf("%c %c %c\n", final_a, opr, final_b);
}