Skip to content

Instantly share code, notes, and snippets.

@yuiswi
Created February 27, 2018 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuiswi/cb517e11d6034676180a58006fe356f7 to your computer and use it in GitHub Desktop.
Save yuiswi/cb517e11d6034676180a58006fe356f7 to your computer and use it in GitHub Desktop.
#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