Created
February 27, 2018 05:13
-
-
Save yuiswi/cb517e11d6034676180a58006fe356f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main(void){ | |
int a,b,R,cnt=0; | |
char line1[20], line2[10]; | |
char *ptr; | |
fgets(line1, sizeof(line1), stdin); | |
ptr = strtok(line1, " "); | |
a = atoi(ptr); | |
while(ptr != NULL){ | |
ptr = strtok(NULL, " "); | |
if(ptr != NULL){ | |
switch (cnt){ | |
case 0: | |
b = atoi(ptr); | |
break; | |
case 1: | |
R = atoi(ptr); | |
break; | |
} | |
cnt++; | |
} | |
} | |
printf("a: %d b: %d R: %d", a, b, R); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment