Advertisement
Guest User

Untitled

a guest
Oct 5th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1.  
  2. // Online IDE - Code Editor, Compiler, Interpreter
  3.  
  4. #include <stdio.h>
  5.  
  6. int main()
  7. {    
  8.     printf("Unesite broj ");
  9.      int n;
  10.      scanf("%d",&n);
  11.      if(n%2==0){
  12.         printf("rezultat je %d ",n/2);
  13.         return 0;
  14.      }
  15.     int result=0;
  16.     int i;
  17.     for(i=1;i<=n/2;i++){
  18.         if(n%i==0){
  19.             result=i;
  20.         }
  21.     }
  22.    
  23.      
  24.      printf("rezultat je %d ",result);
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement