Snoopy의 티스토리

블로그 이미지

juni929

'프로그래밍/Snoopy의 Codeup 정복기'에 해당되는 글 9건

제목 날짜
  • Code up #1406 2018.07.16
  • Code up #1116 2018.04.11
  • Code up #1054 2018.04.11
  • Code up #1042 2018.04.11
  • Codeup #1042 2018.04.06
  • Codeup #1079 2018.04.06
  • Codeup #1173 2018.03.28
  • Codeup #1289 2018.03.28
  • Codeup #1087 2018.03.28

Code up #1406

프로그래밍/Snoopy의 Codeup 정복기 2018. 7. 16. 09:24
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h> // 기본 c 헤더파일

#include <string.h> // 문자열 함수를 불러오기 위한 헤더파일

 
int main()

{

    char a[5]; // 길이가 5인 문자열 배열 선언

    char *b = "love" ; // 포인터 변수 b를 문자열 love 초기화

    scanf("%s", &a); //a 값 입력

    if (! strcmp(b,a)) //문자열 비교 함수 strcmp b가 a랑
 
같으면 0 반환

    {

        printf("I love you."); // 맞다면 printf문 출력

    }

}

Colored by Color Scripter
cs


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1116  (0) 2018.04.11
Code up #1054  (0) 2018.04.11
Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Posted by juni929

Code up #1116

프로그래밍/Snoopy의 Codeup 정복기 2018. 4. 11. 15:04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
int hap(int a, int b) //함수선언 +,-,*,/
{return  a + b ; }
int cha(int a, int b)
{return  a - b ; }
int gob(int a, int b)
{return  a * b ; }
float na(float a, float b)
{return  a / b ; }
int main()
{
    int n, m;
    scanf("%d %d", &n,&m);
        printf("%d+%d=%d\n", n, m,hap(n,m)); //위에서 함수정의 한 것 출력
        printf("%d-%d=%d\n", n, m, cha(n,m));
        printf("%d*%d=%d\n", n, m, gob(n,m));
        printf("%d/%d=%f\n", n, m, na(n,m));
    }
Colored by Color Scripter
cs


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1406  (0) 2018.07.16
Code up #1054  (0) 2018.04.11
Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Posted by juni929

Code up #1054

프로그래밍/Snoopy의 Codeup 정복기 2018. 4. 11. 14:57
1
2
3
4
5
6
7
8
9
10
11
int w(int a, int b)  //함수선언
{
    return  (int)a == b; //참일 경우
}
#include <stdio.h>
int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", t(a,b)); //위의 함수값 출력
}
cs


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1406  (0) 2018.07.16
Code up #1116  (0) 2018.04.11
Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Posted by juni929

Code up #1042

프로그래밍/Snoopy의 Codeup 정복기 2018. 4. 11. 14:47
1
2
3
4
5
6
7
8
9
10
11
int t(int a, int b) //함수선언
{
return  (int)a / b; //a와b로 나눔
 }
#include <stdio.h>
int main() 
{
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", t(a,b)); //함수에서 나눈 값 출력
}
cs


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1116  (0) 2018.04.11
Code up #1054  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Codeup #1173  (0) 2018.03.28
Posted by juni929

Codeup #1042

프로그래밍/Snoopy의 Codeup 정복기 2018. 4. 6. 12:26
#include <stdio.h>
int main() {
char n[30]; //문자열 배열 선언
scanf("%s", n); //넣을 배열에 입력된 내용저장. 공백잇으면 거기까지만 입력됨
for (int i = 0; n[i] != '\0'; i++) //for문에서 배열에 Null
{
printf("\'%c\'\n", n[i]); // \'는 '출력 아까넣은 배열 출력
}
}


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1054  (0) 2018.04.11
Code up #1042  (0) 2018.04.11
Codeup #1079  (0) 2018.04.06
Codeup #1173  (0) 2018.03.28
Codeup #1289  (0) 2018.03.28
Posted by juni929

Codeup #1079

프로그래밍/Snoopy의 Codeup 정복기 2018. 4. 6. 12:13

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
 
int main()
{
    char a;
    while (1)
    {
        scanf("%c ", &a); //a값을 입력
        if (a != 'q') printf("%c\n", a); //만약에 a가 q가 같지 않다면 printf문 계속 a 실행
        else 
        {
            printf("q"); //맞다면 q실행하고 끝냄
            return 0;
        }
    }
}
Colored by Color Scripter
cs


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1173  (0) 2018.03.28
Codeup #1289  (0) 2018.03.28
Codeup #1087  (0) 2018.03.28
Posted by juni929

Codeup #1173

프로그래밍/Snoopy의 Codeup 정복기 2018. 3. 28. 15:04

Snoopy의 Codeup 정복기 #3

#1173

Question

수호는 30분 전으로 돌아가고 싶은 1人 이다.

공백을 기준으로 시간과 분이 주어진다.

그러면 이 시간을 기준으로 30분전의 시간을 출력하시오.

Answer


int main()     
{

int hour, min, result;             //변수 선언

scanf("%d %d", &hour, &min);      //시간 분 입력

result = hour * 60 + min;        // result에다가 분 값으로 다 더함
result = result - 30;            // result에서 30분 뺌

if (result < 0)                 //if문 만약에 result가 0보다
                                    작으면 시간을 23시로 하고 
분에다가 60+result을 해준다
{ hour = 23; min = 60 + result; }
else{ hour = result / 60; min = result % 60;} 
// 시간은 result를 대입하고 분은 result값에서 60으로 나눈 나머지를 대입한다.              
printf("%d %d", hour, min);       // 시간과 분을 출력한다.
}


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Codeup #1289  (0) 2018.03.28
Codeup #1087  (0) 2018.03.28
Posted by juni929

Codeup #1289

프로그래밍/Snoopy의 Codeup 정복기 2018. 3. 28. 09:30

Snoopy의 Codeup 정복기 #2

#1289

Question

학교에서 축구대회를 열기로 했다. 본교 학생 수가 많아서 되도록 큰 운동장을 필요로 한다.

학교 근처에 축구를 할 수 있는 운동장이 3개가 있는데 각 운동장의 가로와 세로의 길이를 홈페이지를 통해서 알 수 있었다.

우리는 3개의 운동장 중 가장 큰 운동장을 빌리기로 했다.

이 3개의 운동장 중 가장 넓은 운동장의 넓이를 구하는 프로그램


Answer

int main() 
{
int a, b, c, d, e, f;            //변수 선언
int x = 0, y = 0, z = 0;        //변수 초기화

scanf("%d %d", &a, &b);    //가로와 세로 길이 입력
scanf("%d %d", &c, &d);
scanf("%d %d", &e, &f);

x = a * b;                 //넓이 계산해서 각 변수에 대입
y = c * d; 
z = e * f;

if (x > y && x > z)         //if문 만약에 x가 제일 크다면
{ printf("%d", x); }         x값 출력
else if (y > x && y > z)  //if문 만약에 y가 제일 크다면 
{ printf("%d", y); }          y값 출력
else                        //그것도 아니면 z값 출력
printf("%d", z);
}


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Codeup #1173  (0) 2018.03.28
Codeup #1087  (0) 2018.03.28
Posted by juni929

Codeup #1087

프로그래밍/Snoopy의 Codeup 정복기 2018. 3. 28. 08:37

Snoopy의 Codeup 정복기 #1

#1087

Question

1, 2, 3 ... 을 계속 더해나갈때, 그 합이 입력한 정수보다 같거나 작을 때까지, (0 ~ 1000) 계속 합하는 프로그램

즉, 1부터 n까지 정수를 계속 합해 간다고 할 때, 어디까지 합해야 같거나 넘어서는지 알아보고자하는 문제이다.

하지만, 이번에는 그 때의 합을 출력해야 한다.

예를 들어 57을 입력하면 1+2+3+...+8+9+10=55 에 다시 11을 더해 66일 때 66이 출력되어야 한다.

Answer

int main() 
{ 
int a, b, c = 0;             // 변수 선언 및 c값 0으로 초기화

scanf("%d", &a);           // 정수 한 개 입력 받음
for (b = 1; ; b++)           // for문으로 b값 1씩 계속 증가
  { 
c += b;                // 계속 더하는 값을 c에 대입
if (c >= a) break;   // c값이 a값보다 커지게 되면 중지
  }
printf("%d", c);          // 마지막으로 최종 나온 c값 출력
}


'프로그래밍 > Snoopy의 Codeup 정복기' 카테고리의 다른 글

Code up #1042  (0) 2018.04.11
Codeup #1042  (0) 2018.04.06
Codeup #1079  (0) 2018.04.06
Codeup #1173  (0) 2018.03.28
Codeup #1289  (0) 2018.03.28
Posted by juni929
이전페이지 다음페이지
블로그 이미지

by juni929

공지사항

    최근...

  • 포스트
  • 댓글
  • 트랙백
  • 더 보기

태그

글 보관함

«   2025/06   »
일 월 화 수 목 금 토
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

링크

카테고리

분류 전체보기 (20)
Arduino (2)
프로그래밍 (13)
Snoopy의 Codeup 정복기 (9)
Python (1)
라즈베리파이 (2)
웹 (1)

카운터

Total
Today
Yesterday
방명록 : 관리자 : 글쓰기
juni929's Blog is powered by daumkakao
Skin info material T Mark3 by 뭐하라
favicon

Snoopy의 티스토리

  • 태그
  • 링크 추가
  • 방명록

관리자 메뉴

  • 관리자 모드
  • 글쓰기
  • 분류 전체보기 (20)
    • Arduino (2)
    • 프로그래밍 (13)
      • Snoopy의 Codeup 정복기 (9)
      • Python (1)
    • 라즈베리파이 (2)
    • 웹 (1)

카테고리

PC화면 보기 티스토리 Daum

티스토리툴바