LOVEGUN

Divisibilité par 2 (Série ISI)

Oct 11th, 2021 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n,i,aux;
  7.     printf ("Donner un entier: ");
  8.     scanf ("%d",&n);
  9.     aux=n;
  10.     i=0;
  11.     do{
  12.         if (n%2==0)
  13.         {
  14.             i++;
  15.             n=n/2;
  16.         }
  17.     }while (n%2==0);
  18.     printf ("%d est divisible %d fois par 2",aux,i);
  19. }
  20.  
Add Comment
Please, Sign In to add comment