mirror of
https://gitlab.gwdg.de/j.hahn02/university.git
synced 2026-01-01 06:44:25 -05:00
refactor various files
This commit is contained in:
24
S1/GdCP/uebung/clean.c
Normal file
24
S1/GdCP/uebung/clean.c
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#include<stdio.h>
|
||||
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#define N 998
|
||||
|
||||
int main() {
|
||||
int b = 0, r = 0, i = 0;
|
||||
while ((b = getchar()) != '\n') {
|
||||
if (i % 2 == 0) r -= b - '0';
|
||||
else r += b - '0';
|
||||
i++;
|
||||
}
|
||||
if(r == -4) r = 4;
|
||||
if(r == -10) r = 10;
|
||||
if(r == -1) r = 1;
|
||||
printf("%d\n", r);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user