LOVEGUN

Nombre totalement impairs

Oct 10th, 2021 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n,p,j,i,test;
  7.     do{
  8.         printf ("Saisir N: ");
  9.         scanf ("%d",&n);
  10.     }while (n<=10);
  11.     i=0;
  12.     test=1;
  13.     do{
  14.         i++;
  15.         j=n%10;
  16.         if ((i%2!=0) && (j%2==0))
  17.         {
  18.             test=0;
  19.         }
  20.         n=n/10;
  21.     }while (test==1 && n!=0);
  22.     if (test==1)
  23.     {
  24.         printf ("Le nombre est totalement impairs");
  25.     }else
  26.     {
  27.         printf ("Le nombre n'est pas totalement impairs");
  28.     }
  29. }
  30.  
Add Comment
Please, Sign In to add comment