SHARE
TWEET

Untitled

a guest Feb 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4.  
  5. int main()
  6. {
  7.   int getal;
  8.   int i;
  9.  
  10.   printf("Voor een getal in: ");
  11.   scanf("%/n", &getal);
  12.  
  13.  
  14.   for(i = 2; i <= getal / 2; ++i)
  15.   {
  16.     if(getal % i == 0)
  17.     {
  18.       printf("Dit is een priemgetal");
  19.       system("PAUSE");
  20.     }
  21.     else
  22.     {
  23.       printf("Dit is geen priemgetal");
  24.     }
  25.   }
  26.   return 0;
  27. }
  28.    
  29. #include <iostream>
  30. #include <stdio.h>
  31.  
  32.  
  33.  
  34. int main()
  35. {
  36.   int getal;
  37.   int i;
  38.   bool IsPriem = true;
  39.  
  40.   printf("Voor een getal in: ");
  41.   scanf("%d", &getal);
  42.  
  43.   for(i = 2; i <= getal / 2; ++i)
  44.    {
  45.       if(getal % i == 0)
  46.       {
  47.     IsPriem = false;
  48.       break;
  49.       }
  50.   }
  51.   if(getal <2){
  52.     IsPriem = false;
  53.   }
  54.  
  55.       if (IsPriem){
  56.       printf("Dit is een priemgetal");
  57.       }
  58.     else {
  59.  
  60.       printf("Dit is geen priemgetal");
  61. }
  62.  
  63.   return 0;
  64.  
  65. }
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