// #include <stdio.h>
// #include <string.h>

// int main() {
//     char str1[20];
//     char str2[20];
//     char str3[40];

//     fgets(str1, sizeof(str1), stdin);
//     fgets(str2, sizeof(str2), stdin);

//     strncpy(str3, str1, strlen(str1)-1);
//     strcat(str3, str2);

//     printf("%s", str1);
//     printf("%s\n", str2);
//     printf("%s", str3);
//     return 0;
// }

// #include <stdio.h>
// #include <string.h>
// #include <stdlib.h>

// int main(void){
//     char str[100];
//     int i, sum=0, len; 
//     fgets(str, sizeof(str), stdin);
//     len=strlen(str);
    
//     for(i=0; i<len; i++){
//         if('1'<=str[i] && str[i]<='9'){
//             sum+=str[i]-48;
//         }
//     }
//     printf("%d", sum);
//     return 0;
// }

#include <stdio.h>
#include <string.h>

int main(void){
    char a[20];
    char b[20];
    char name1[20];
    char name2[20];
    char age1[20];
    char age2[20];
    int i=0, t1, t2;
    fgets(a, sizeof(a), stdin);
    fgets(b, sizeof(b), stdin);
    a[strlen(a)-1]='\0';   // 엔터 제거
    
    while(a[i]!=' '){         // 이름만 따로 저장
        name1[i]=a[i];
        i++;
    }
    t1=i+1;     // 나이가 시작되는 값
    i=0;
    while(b[i]!=' '){
        name2[i]=b[i];
        i++;
    }
    t2=i+1;
    i=0;
    
    while(a[t1]!='\0'){       // 나이 저장
        age1[i]=a[t1];
        t1++;
        i++;
    }
    i=0;
    while(b[t2]!='\0'){
        age2[i]=b[t2];
        t2++;
        i++;
    }

    if(!strcmp(name1, name2)){
        puts("이름이 같다.");
    }
    else{
        puts("이름이 같지않다.");
    }
    if(!strcmp(age1, age2)){
        puts("나이가 같다.");
    }
    else{
        puts("나이가 같지않다.");
    }

    printf("%d, %d", t1, t2);
    return 0;
}






Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: