Paisen

do_while4

Sep 20th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int a,i=1,cont;
  4. int main (){
  5.    
  6.     printf("Digite un numero\n");
  7.     scanf("%d",&a);
  8.    
  9.     do{
  10.         i++;
  11.     if(a%i==0){
  12.         cont++;
  13.         }      
  14.     }while(i<=a);
  15.    
  16. if(cont<2){
  17. printf("Es primo");
  18. }else
  19. printf("Es numero compuesto");
  20.    
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment