Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. main()
  3. {
  4. printf("**************************\n");
  5. printf("Déterminer si un nombre entier est pair ou impair\n");
  6. printf("**************************\n");
  7. printf("\n");
  8.  
  9. int n , q, r ;
  10. printf("Entrez un nombre entier: ");
  11. scanf("%d", &n);
  12. q = n/2 ;
  13. r = n%2 ;
  14.  
  15. printf("-------------------------\n");
  16. printf("\n");
  17.  
  18. if (r==0) {
  19. printf("Le nombre %d est pair.\nSa moitié est %d.\n", n,q);
  20. } else {
  21. printf("Le nombre %d est impair.\nIl en reste %d de sa division en deux d'un quotient de %d.\n", n,r,q);
  22. }
  23.  
  24. printf("\n");
  25. printf("-------------------------\n");
  26. printf("\n");
  27. system("pause");
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement