SHARE
TWEET

Untitled

a guest Mar 26th, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  #include <stdlib.h>
  3.  
  4.  
  5.  
  6.  
  7. int main (int argc, char * argv[])
  8. {
  9.     int n, l, i, min , t;
  10.     l=0;
  11.     printf("inserisci un numero naturale >0");
  12.     scanf("%d" , &n);
  13.     whie(l<1)
  14.     {
  15.         if(n==0)
  16.         printf("errore, devi inserire un numero maggiore di 0");
  17.         else l=1;
  18.        
  19.     }
  20.    
  21.     int ar[n];
  22.    
  23.     for(i=1; i<=n;i++)
  24.     {
  25.         printf("inserisciun numero");
  26.         scanf( "%d" , &ar[i]);
  27.     }
  28.     min= ar[0];t=0;
  29.     for(i=1;i<=n;i++)
  30.     {
  31.         if(min > ar[i])
  32.             min=ar[i];
  33.         t=i;
  34.         else;
  35.     }
  36.     ar[t]=ar[0]; ar[0]=min;
  37.    
  38.    
  39.    
  40.    
  41.    
  42.    
  43.  
  44.  
  45.  
  46.  exit (EXIT_SUCCESS);
  47.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top