Advertisement
winone1208

Untitled

Jan 17th, 2021
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. //Napisać program sprawdzający czy dany rok wprowadzony z klawiatury jest przestępny czy nie
  2. //
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  7.  
  8. int main() {
  9.     int x=1;
  10.     printf("0 konczy program\n");
  11.     printf("Podaj rok\n");
  12.     scanf("%d", &x);
  13.     do{
  14.        
  15.         if ((x%4==0 && x%100!=0) || x%400==0){
  16.             printf("Rok przestepny\n");
  17.         } else {
  18.             printf("rok nie przestepny\n");
  19.         }
  20.         scanf("%d", &x);
  21.     }while(x!=0);
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement