Aktualizovat „du4/program.c“

This commit is contained in:
Artem Horbunov 2020-04-02 15:51:05 +00:00
parent f8cd7b9890
commit 9006ab5b4e

View File

@ -3,9 +3,9 @@
int main(){ int main(){
char read[1000000]; char read[1000000];
scanf("%[^\n]", read); scanf("%[^\n]", read);
int num1, num2, answer; float num1, num2, answer;
char action; char action;
sscanf(read, "%d %c %d %*c %d", &num1, &action, &num2, &answer); sscanf(read, "%f %c %f %*c %f", &num1, &action, &num2, &answer);
if(action != '/' && action != '*' && action != '-' && action != '+'){ if(action != '/' && action != '*' && action != '-' && action != '+'){
printf("CHYBA\n"); printf("CHYBA\n");
return -1; return -1;