Advertisement
Ilija123

Vezba 6- Zadatak 4.

Feb 21st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. main()
  3. {
  4.     int d, m, g, prestupna, rd;
  5.  
  6.     printf("Uneti redni broj dana u mesecu\n");
  7.     printf("\td=");
  8.     scanf("%d", &d);
  9.     printf("Uneti redni broj meseca u godini\n");
  10.     printf("\tm=");
  11.     scanf("%d", &m);
  12.     printf("Uneti godinu\n");
  13.     printf("\tg=");
  14.     scanf("%d", &g);
  15.  
  16.     switch(m-1)
  17.     {
  18.     case 11:
  19.         d+=30;
  20.     case 10:
  21.         d+=31;
  22.     case 9:
  23.         d+=30;
  24.     case 8:
  25.         d+=31;
  26.     case 7:
  27.         d+=31;
  28.     case 6:
  29.         d+=30;
  30.     case 5:
  31.         d+=31;
  32.     case 4:
  33.         d+=30;
  34.     case 3:
  35.         d+=31;
  36.     case 2:
  37.         if(g%400==0 || (g%4==0 && g%100 !=0))
  38.             d+=29;
  39.         else
  40.             d+=28;
  41.     case 1:
  42.         d+=31;
  43.     }
  44.     printf("%d. dan po redu", d);
  45.     getch();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement