
29-12-2005, 19:28
|
|
|
|
חבר מתאריך: 24.11.05
הודעות: 317
|
|
בבקשה
קוד:
#include <stdio.h>
void main()
{
int Num,Num2,I,max,min,locmax,locmin;
printf("Enter number No.1-->");
scanf("%d",&Num);
printf("Enter number No.2-->");
scanf("%d",&Num2);
if (Num>Num2)
{
max=Num;
min=Num2;
locmax=1;
locmin=2;
}
else
{
max=Num2;
min=Num;
locmax=2;
locmin=1;
}
for (I=3;I<=10;I++)
{
printf("Enter number No.%d-->",I);
scanf("%d",&Num);
if (Num>max){
max=Num;
locmax=I; }
else if (Num<min){
min=Num;
locmin=I; }
}
printf("The max number is %d and is location is %d\n",max,locmax);
printf("The min number is %d and is location is %d\n",min,locmin);
getch();
}
|