본문 바로가기
Algorithm/JUNGOL

C언어, JUNGOL 9111 ~ 9120

by OdOp 관리자 2024. 1. 16.
SMALL

jungol 9111부터 jungol 9120까지 c언어로 작성된 코드입니다.

참고해 주시면 좋을 것 같습니다. 

 

jungol 9111

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

int n;
char arr[6], c[17] = "jungol olympiad";

int main()
{
    for (int i = 0; i < 5; i++)
    {
        scanf("%d", &n);
        arr[i] = c[n];
    }
    for (int i = 0; i < 5; i++)
        printf("%c", arr[i]);
    return 0;
}

 

jungol 9112

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

char c[100];

int main()
{
    int a;

    scanf("%s", c);
    a = strlen(c);
    printf("입력받은 문자열의 길이는 %d입니다.\n", a);
    for (int i = a - 1; i >= 0; i--)
        printf("%c", c[i]);
    return 0;
}

 

jungol 9113

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

int len;
char c[100] = "우리나라 대한민국!";

int main()
{
    len = strlen(c);
    printf("%s\n", c);
    printf("위 문자열의 길이는 %d입니다.", len);
    return 0;
}

 

jungol 9114

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

int len;
char c[100];

int main()
{
    while (1)
    {
        scanf("%s", c);
        if ((int)c[0] >= 48 && (int)c[0] <= 57)
            printf("숫자문자입니다.\n");
        else if ((int)c[0] >= 65 && (int)c[0] <= 90)
            printf("대문자입니다.\n");
        else if ((int)c[0] >= 97 && (int)c[0] <= 122)
            printf("소문자입니다.\n");
        else
        {
            printf("영문, 숫자 이외의 문자입니다.\n");
            break;
        }
    }
    return (0);
}

 

jungol 9115

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

int len;
char c[100];

int main()
{
    scanf("%s", c);
    len = strlen(c);
    for (int i = 0; i < len; i++)
    {
        if ((int)c[i] >= 65 && (int)c[i] <= 90)
            c[i] += 32;
        else if ((int)c[i] >= 97 && (int)c[i] <= 122)
            c[i] -= 32;
        printf("%c", c[i]);
    }
    return (0);
}

 

jungol 9116

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

int main()
{
    char c[100];
    scanf("%[^\n]s", c);
    //scnaf로 공백을 포함해서 입력을 받을려면 %[^\n]s의 서식문자를 사용하면 됨 
    char* ptr = strtok(c, " ");
    while (ptr != NULL)
    {
        printf("%s\n", ptr);
        ptr = strtok(NULL, " ");
    }
    return (0);
}

 

jungol 9117

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


int main() {
    int count;
    int len;
    char c[100];

    count = 0;
    scanf("%[^\n]s", c);
    len = strlen(c);
    for (int i = 1; i <= len; i++)
    {
        for (int j = 0; j < len; j++)
        {
            count = (i + j) % len;
            printf("%c", c[count]);
        }
        printf("\n");
    }
    return 0;
}

 

jungol 9118

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
    char *ptr_ary[5][20];
    int i;

    for(i=0; i<5; i++)
        scanf("%s", &ptr_ary[i]);
    for(i=0; i<5; i++)
        printf("%s\n", ptr_ary[i]);
    return (0);
}

 

jungol 9119

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


int main()
{
    char str[50];
    char* ptr_ary[50] = { 0, };
    int i;
    char* ptr;

    scanf("%[^\n]s", str);
    ptr = strtok(str, " ");
    i = 0;
    while (ptr != NULL)
    {
        ptr_ary[i] = ptr;
        i++;
        ptr = strtok(NULL, " ");
    }
    for (int j = 0; j < i; j++)
        printf("%s\n", ptr_ary[j]);
    return 0;
}

 

jungol 9120

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


int main()
{
    char str[50];
    char* ptr_ary[50] = { 0, };
    int i;
    char* ptr;

    scanf("%[^\n]s", str);
    ptr = strtok(str, " ");
    i = 0;
    while (ptr != NULL)
    {
        ptr_ary[i] = ptr;
        i++;
        ptr = strtok(NULL, " ");
    }
    for (int j = 0; j < i; j++)
        printf("%s\n", ptr_ary[j]);
    return 0;
}
LIST

'Algorithm > JUNGOL' 카테고리의 다른 글

C언어, JUNGOL 611 ~ 620  (2) 2023.12.31
C언어, JUNGOL 201 ~ 210  (0) 2023.12.01
C언어, JUNGOL 601 ~ 610  (2) 2023.11.30
C언어, JUNGOL 9101 ~ 9110  (0) 2023.11.29
C언어, JUNGOL 191 ~ 200  (2) 2023.11.28