Advertisement
Avdluna

Untitled

Aug 17th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main (){
  4.    
  5. int n,y,pos,i,j;
  6.         scanf("%d",&n);
  7.        
  8.      int x[n];
  9.        
  10.     for (i=0;i<n;i++){
  11.             scanf("%d",&x[i]);
  12.             }
  13.        
  14.     y=x[0];
  15.        
  16.     for (j=0;j<n;j++){
  17.             if(x[j]<y){
  18.                 y=x[j];
  19.                 pos=j;
  20.             }
  21.         }
  22.         printf("Menor valor: %d\nPosicao: %d\n",y,pos);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement