코드업 C 베이직 100 (1065~1092)

1065

#include <stdio.h>

int main() {

    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if (a % 2 == 0)
    {
        printf("%d\n", a);
    }
    if (b % 2 == 0)
    {
        printf("%d\n", b);
    }
    if (c % 2 == 0)
    {
        printf("%d\n", c);
    }


    return 0;
}

1066

#include <stdio.h>

int main() {

    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if (a % 2 == 0)
    {
        printf("even\n", a);
    }
    else
    {
        printf("odd\n");
    }
    if (b % 2 == 0)
    {
        printf("even\n", b);
    }
    else
    {
        printf("odd\n");
    }
    if (c % 2 == 0)
    {
        printf("even\n", c);
    }
    else
    {
        printf("odd\n");
    }


    return 0;
}

1067

#include <stdio.h>

int main() {

    int a;
    scanf("%d", &a);
    if (a > 0)
    {
        printf("plus\n", a);
    }
    else
    {
        printf("minus\n", a);
    }

    if (a % 2 == 0)
    {
        printf("even\n", a);
    }
    else
    {
        printf("odd\n",a);
    }
    
    return 0;
}

1068

#include<stdio.h>
int main() 
{
    int a;
    scanf("%d", &a);
    if (a >= 90 && a <= 100)
    {
        printf("A");
    }
    else if (a >= 70 && a <= 89)
    {
        printf("B");
    }
    else if (a >= 40 && a <= 69)
    {
        printf("C");
    }
    else if (a >= 0 && a <= 39)
    {
        printf("D");
    }

}

1069

#include<stdio.h>

int main() 
{
    char op;

    scanf("%c", &op);

    switch (op)
    {
    case 'A':
        printf("best!
!
!
"); break; case 'B': printf("good!
!
"); break; case 'C': printf("run!
"); break; case 'D': printf("slowly~"); break; default: printf("what?"); } return 0; }

1070

#include<stdio.h>

int main() 
{
    int a;
    scanf("%d", &a);

    switch (a)
    {
    case 1:
    case 2:
    case 12:
        printf("winter");
        break;
    case 3:
    case 4:
    case 5:
        printf("spring");
        break;
    case 6:
    case 7:
    case 8:
        printf("summer");
        break;
    case 9:
    case 10:
    case 11:
        printf("fall");
        break;

    }

    return 0;
}

1071

#include<stdio.h>

int main()
{
    int n;

reload:
    scanf("%d", &n);
    if (n !
= 0) { printf("%d\n", n); goto reload; } return 0; }

1072

#include<stdio.h>

int main()
{
    int n, m;
    scanf("%d", &n);

reget:
    scanf("%d", &m);
    printf("%d\n", m);
    if (--n !
= 0) goto reget; return 0; }

1073

#include <stdio.h>
int main()
{
	int i = 1;

	while (i !
= 0) { scanf("%d", &i); if (i !
= 0) printf("%d\n", i); } return 0; }

1074

#include<stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    while (n !
= 0) { printf("%d\n", n); n = n - 1; } return 0; }

1075

#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	while (n !
= 0) { n--; printf("%d\n", n); } return 0; }

1076

#include<stdio.h>

int main()
{
    char x, t="a";
    scanf("%c", &x);
    do
    {
        printf("%c ", t);
        t += 1; 
    } while (t < x + 1); 

    return 0;
}

1077

#include<stdio.h>

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

1078

#include<stdio.h>

int main()
{
    int n;
    int sum = 0;
    scanf("%d", &n);

    for (int i = 0; i <= n; i++) 
    {
        if (i % 2 == 0) 
        {
            sum = sum + i;
        }
    }
    printf("%d\n", sum);
    return 0;
}

1079

#include <stdio.h>

int main()
{
    char n;     
    while (1)    
    {
        scanf("%c", &n);    
        printf("%c", n);    
        if (n == 'q')      
            break;          
    }
    return 0;
}

1080

#include <stdio.h>

int main(void)
{
    int n = 0;
    int sum = 0;
    int i;
    scanf("%d", &n);

    for (i = 0; n > sum; i++)
        sum += i;
        printf("%d", i - 1);
    
    

    return 0;
}

1081

#include<stdio.h>

void main()
{
	int a, b;

	scanf("%d %d", &a, &b);

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

	return 0;
}

1082

#include<stdio.h>

void main()
{
	int a, b;

	scanf("%d %d", &a, &b);

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

	return 0;
}

1083

#include<stdio.h>

void main()
{
	int n;

	scanf("%d", &n);
	for (int i = 1; i < n + 1; i++)
	{
		if (!
(i % 3) || !
(i % 6) || !
(i % 9)) printf("X "); else printf("%d ", i); } return; }

1084

#include<stdio.h>

void main()
{
	int a, b, c, count = 0;

	scanf("%d %d %d", &a, &b, &c);
	for (int i = 0; i < a; i++)
		for (int j = 0; j < b; j++)
			for (int k = 0; k < c; k++)
			{
				printf("%d %d %d\n", i, j, k);
				count++;
			}
	printf("%d", count);

	return 0;
}

1085

#include<stdio.h>

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

	scanf("%d %d %d %d", &a, &b, &c, &d);
	printf("%.1lf MB", ((((double)a * b * c * d) / 8) / 1024) / 1024);

	return 0;
}

1086

#include<stdio.h>

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

	scanf("%d %d %d", &a, &b, &c);
	printf("%.2lf MB", (((((double)a * b * c) / 8) / 1024) / 1024));

	return 0;
}

1087

#include<stdio.h>

void main()
{
	long long int n, sum = 0;

	scanf("%lld", &n);
	for (int i = 0; sum < n; i++)	sum += i;
	printf("%lld", sum);

	return 0;
}

1088

#include<stdio.h>

void main()
{
	unsigned int n;

	scanf("%d", &n);
	for (int i = 0; i <= n; i++)
	{
		if (!
(i % 3)) continue; printf("%d ", i); } return 0; }

1089

#include<stdio.h>

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

	scanf("%d %d %d", &a, &b, &c);
	if(c > 0) 
	printf("%d", a + (b * (c - 1)));

	return 0;
}

1090

#include<stdio.h>
#include<math.h>

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

	scanf("%lld %lld %lld", &a, &b, &c);
	if (c > 0)	
    printf("%lld", a * (int)pow((long long int)b, (long long int)(c - 1)));

	return 0;
}

1091

#include<stdio.h>

int main()
{
	long long int a, b, c, n, sum = 0;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &n);

	if (n !
= 1) sum = a * b + c; else sum = a; if (n > 0) for (int i = 1; i < n - 1; i++) sum = sum * b + c; else{ fputc('0', stdout); return -1; } printf("%lld", sum); return 0; }

1092

#include<stdio.h>

int main()
{
	int a, b, c, d = 1;

	scanf("%d %d %d", &a, &b, &c);
	
	while (d % a !
= 0 || d % b !
= 0 || d % c !
= 0) d++; printf("%d", d); return 0; }