Min Value

#include<stdio.h>

/*

Acquisisci 10 numeri e stampa il minore e l’indice di quel numero nella lista

*/

void main () {

int num[10];

int i,min,j;

for(i=0;i<10;i++) {

printf(“Inserire numero”);

scanf(“%d”,&num[i]);

}

min = num[0];

for(i=0;i<10;i++) {

if(num[i]<min)

min=num[i];

}

for(i=0;i<10;i++) {

if(num[i]==min) {

printf(“L’indice e’ %d -> “,i);

printf(“iL MINIMO e’ %d\n”,min);

}

}

}

Share:
  • Print
  • Facebook
  • Google Bookmarks
  • Google Buzz
  • Twitter
This entry was posted in C-trial, InfoLearn. Bookmark the permalink.

Comments are closed.