Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- main()
- {
- printf("**************************\n");
- printf("Déterminer si un nombre entier est pair ou impair\n");
- printf("**************************\n");
- printf("\n");
- int n , q, r ;
- printf("Entrez un nombre entier: ");
- scanf("%d", &n);
- q = n/2 ;
- r = n%2 ;
- printf("-------------------------\n");
- printf("\n");
- if (r==0) {
- printf("Le nombre %d est pair.\nSa moitié est %d.\n", n,q);
- } else {
- printf("Le nombre %d est impair.\nIl en reste %d de sa division en deux d'un quotient de %d.\n", n,r,q);
- }
- printf("\n");
- printf("-------------------------\n");
- printf("\n");
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement