file name:- minmax1d.cpp
#include<iostream.h>
#include<conio.h>
#define N 10
void main(){
float list[N],min,max;
int i;
clrscr();
cout<<"Enter elements of array List"<<endl;
for(i=0;i<N;i++){
cout<<"Enter "<<i+1<<" element=";
cin>>list[i];
}
min=max=list[0];
for(i=1;i<N;i++){
if(min>list[i]) min=list[i];
if(max<list[i]) max=list[i];
}
cout<<"Minimum element = "<<min<<" and Maximum element = "<<max<<endl;
getch();
}
#define N 10
void main(){
float list[N],min,max;
int i;
clrscr();
cout<<"Enter elements of array List"<<endl;
for(i=0;i<N;i++){
cout<<"Enter "<<i+1<<" element=";
cin>>list[i];
}
min=max=list[0];
for(i=1;i<N;i++){
if(min>list[i]) min=list[i];
if(max<list[i]) max=list[i];
}
cout<<"Minimum element = "<<min<<" and Maximum element = "<<max<<endl;
getch();
}
file name:- minmax1d.c
void main(){
float list[N],min,max;
int i;
clrscr();
printf("Enter Elements of Array LIst\n");
for(i=0;i<N;i++){
printf("enter %d element=",i+1);
scanf("%f",&list[i]);
}
min=max=list[0];
for(i=1;i<N;i++){
if(min>list[i]) min=list[i];
if(max<list[i]) max=list[i];
}
printf("Minimum Element =%.2f and Maximum Element = %.2f",min,max);
getch();
}
#include<stdio.h>
#include<conio.h>
#define N 10void main(){
float list[N],min,max;
int i;
clrscr();
printf("Enter Elements of Array LIst\n");
for(i=0;i<N;i++){
printf("enter %d element=",i+1);
scanf("%f",&list[i]);
}
min=max=list[0];
for(i=1;i<N;i++){
if(min>list[i]) min=list[i];
if(max<list[i]) max=list[i];
}
printf("Minimum Element =%.2f and Maximum Element = %.2f",min,max);
getch();
}
No comments:
Post a Comment