This commit is contained in:
Yaroslav Orlianskyi 2022-03-17 20:15:29 +01:00
parent 81d34b9541
commit cd455fa2e2
4 changed files with 24 additions and 32 deletions

Binary file not shown.

View File

@ -1,32 +1,21 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 999
int main(){ int main(){
char riadok[LINE_SIZE]; int vxod[999];
memset(riadok, 0,LINE_SIZE); int i = 0;
char* r = fgets(riadok,LINE_SIZE,stdin); int result = 0;
char line[LINE_SIZE]; while(1){
int len = strlen(line); int value = 0;
char* endptr = NULL; int r = scanf("%d",&value);
char* start = line; if(r == 1){
int num = 0; vxod[i++] = value;
if (r == NULL){
exit(0);
} }
int r2 = atol(line); else{
if (r2 == 0){ for(int a = 1; a < i; a++)
exit(0); result = vxod[0] * result + vxod[a];
} printf("Vysledok je: %d.00\n", result);
while (start < (line + len)){
num = strtol(start,&endptr,10);
if (num){
printf("Nacital som %d\n",num);
start = endptr + 1;
}
else
break; break;
} }
}
return 0; return 0;
} }

BIN
du3/test

Binary file not shown.

View File

@ -1,11 +1,14 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 999
int main(){ int main(){
int c = 0; char riadok[LINE_SIZE];
char a = 'a'; memset(riadok, 0,LINE_SIZE);
if(a >= 0 && a <= 255) char* r = fgets(riadok,LINE_SIZE,stdin);
printf("yes\n"); if(r == NULL){
else exit(0);
printf("no\n"); }
return 0; return 0;
} }