added weekly exercises of isp-ws25
This commit is contained in:
32
c/isp-ws25/weeklies/week02/w02ex02.c
Executable file
32
c/isp-ws25/weeklies/week02/w02ex02.c
Executable file
@@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int votes_windows;
|
||||
int votes_linux;
|
||||
|
||||
printf("Votes for Windows: ");
|
||||
scanf("%d", &votes_windows);
|
||||
|
||||
printf("Votes for Linux: ");
|
||||
//scanf("%c", &votes_linux);
|
||||
scanf("%d", &votes_linux);
|
||||
|
||||
// Compare the votes and announce the winner
|
||||
//if (votes_windows = votes_linux)
|
||||
if (votes_windows == votes_linux)
|
||||
{
|
||||
printf("It's a tie between Windows and Linux!\n");
|
||||
}
|
||||
//else (votes_windows < votes_linux)
|
||||
else if (votes_windows > votes_linux)
|
||||
{
|
||||
printf("Windows wins!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Linux wins!\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user