Files
2026-10-18 11:35:33 +02:00

38 lines
850 B
C

#include <stdio.h>
#include <stdlib.h>
/* Frage 1: Write a program that reads from the user 2 values
of an "integer" type. The program should print "EQUAL" if both
the values are equal. Otherwise, the program should print "NOT EQUAL". */
int main()
{
int val1, val2, val3, auswertung;
printf("EQUAL or NOT EQUAL\n");
printf("Value 1: ");
scanf("%i", &val1);
printf("Value 2: ");
scanf("%i", &val2);
printf("Value 3: ");
scanf("%i", &val3);
auswertung = (val1 == val2 && val2 == val3) ? 1 : 2;
printf("Auswertung: %i\n", auswertung);
switch (auswertung)
{
case 1:
printf("%i and %i and %i are equal\n", val1, val2, val3);
break;
case 2:
printf("%i and %i and %i are not equal\n", val1, val2, val3);
break;
default:
break;
}
return 0;
}