본문 바로가기
Algorithm/JUNGOL

C언어, JUNGOL 571 ~ 580

by OdOp 관리자 2023. 11. 21.
SMALL

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

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

 

jungol 571

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int line(void)
{
    printf("~!@#$^&*()_+|\n");
}

int main(void)
{
    int n;

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        line();
    }
    return 0;
}

 

jungol 572

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void size(float a)
{
    printf("%.2f" ,a * a * 3.14);
}

int main(void)
{
    int n;

    scanf("%d", &n);
    size(n);
    return 0;
}

 

jungol 573

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void array(int a)
{
    int b;

    b = 1;
    for (int i = 0; i < a; i++)
    {
        for (int j = 0; j < a; j++)
        {
            printf("%d ", b);
            b++;
        }
        printf("\n");
    }
}

int main(void)
{
    int n;

    scanf("%d", &n);
    array(n);
    return 0;
}

 

jungol 574

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

int j_574_1(int a, int b, int c)
{
    if (a >= b)
    {
        b = a;
    }
    else
    {
        a = b;
    }
    if (a >= c)
    {
        return a;
    }
    else
    {
        return c;
    }
}

int main(void)
{
    int a;
    int b;
    int c;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    printf("%d", j_574_1(a, b, c));
    return 0;
}

 

jungol 575

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int j_575_1(int a, int b)
{
    int answer;
    
    answer = 1;
    for (int i = 0; i < b; i++)
    {
        answer *= a;
    }
    return answer;
}

int main(void)
{
    int a;
    int b;
    
    scanf("%d", &a);
    scanf("%d", &b);
    printf("%d", j_575_1(a, b));
    return 0;
}

 

jungol 576

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int j_576_1(int a, int b, char n[1])
{
    if ((int)n[0] == 43)
    {
        return a + b;
    }
    else if ((int)n[0] == 45)
    {
        return a - b;
    }
    else if ((int)n[0] == 42)
    {
        return a * b;
    }
    else if ((int)n[0] == 47)
    {
        return a / b;
    }
    else
    {
        return 0;
    }
}

int main(void)
{
    char n[2];
    int a;
    int b;

    scanf("%d %s %d", &a, &n, &b);
    printf("%d %s %d = %d", a, n, b, j_576_1(a, b, n));
    return 0;
}

 

jungol 577

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int x;
int y;

void j_577_1(int a, int b)
{
    if (a >= b)
    {
        x = a / 2;
        y = b * 2;
    }
    else
    {
        x = a * 2;
        y = b / 2;
    }
}

int main(void)
{
    int a;
    int b;
    
    scanf("%d %d", &a, &b);
    j_577_1(a, b);
    printf("%d %d", x, y);
    return 0;
}

 

jungol 578

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void j_578_1(int min, int max)
{
    for (int i = min; i < max + 1; i++)
    {
        printf("== %ddan ==\n", i);
        for (int j = 1; j <= 9; j++)
        {
            printf("%d * %d = %2d\n", i, j, i * j);
        }
        printf("\n");
    }
}

int main(void)
{
    int a;
    int b;
    int n;
    
    a = 0;
    b = 0;
    scanf("%d %d", &a, &b);
    if (a > b)
    {
        j_578_1(b, a);
    }
    else
    {
        j_578_1(a, b);        
    }
    return 0;
}

 

jungol 579

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void)
{
    int arr1[11] = { 0, };
    int n;
    int a;

    scanf("%d", &a);
    for (int i = 0; i < a; i++)
    {
        scanf("%d", &n);
        arr1[i] = n;
    }
    for (int i = 0; i < a; i++)
    {
        for (int j = i; j < a; j++)
        {
            if (arr1[i] < arr1[j])
            {
                n = arr1[i];
                arr1[i] = arr1[j];
                arr1[j] = n;
            }
        }
        printf("%d ", arr1[i]);
    }
    return 0;
}

 

jungol 580

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
    int day;
    int month;

    scanf("%d %d", &month, &day);
    switch (month)
    {
    case 1:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 2:
        if (day <= 29 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 3:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 4:
        if (day <= 30 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 5:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 6:
        if (day <= 30 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 7:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 8:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 9:
        if (day <= 30 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 10:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 11:
        if (day <= 30 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    case 12:
        if (day <= 31 && day > 0)
        {
            printf("OK!");
            break;
        }
        else
        {
            printf("BAD!");
            break;
        }
    default:
        printf("BAD!");
        break;
    }
    return 0;
}
LIST

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

C언어, JUNGOL 9081 ~ 9090  (1) 2023.11.23
C언어, JUNGOL 171 ~ 180  (0) 2023.11.22
C언어, JUNGOL 9071 ~ 9080  (2) 2023.11.20
C언어, JUNGOL 161 ~ 170  (0) 2023.11.19
C언어, JUNGOL 561 ~ 570  (0) 2023.11.18