SHARE
TWEET

oddoreven.c

Turpo-Urpo Jun 28th, 2020 993 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int main(void) {
  3.      
  4.     int luku = 1;
  5.        
  6.     printf("\n");
  7.     printf(" Ohjelma kertoo onko antamasi kokonaisluku parillinen vai pariton.\n");
  8.     printf(" Ohjelman lopetus tapahtuu, antamalla luku nolla (0).\n");
  9.    
  10.     while ( luku > 0)
  11.     {
  12.         printf( "\n Syötä luku: "); scanf("%d", &luku);
  13.         if ( luku > 0 )
  14.         {
  15.             if (luku % 2) { printf(" Luku %d on pariton \n", luku); }
  16.             else { printf(" Luku %d on parillinen \n", luku); };
  17.         }
  18.     }
  19.     return(0);
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top