//wap to modify the array elemens.
in 5 element int array find positive number and
replaced it with 1 and find negative number and replaced it with 0.
#include <iostream>
int main()
{
int x[5],i;
cout<<"Enter 5 values";
for (i=0;i<5;i++)
{
cin>>x[i];
}
for (i=0;i<5;i++)
{
if (x[i]>0)
x[i]=1;
else
x[i]=0;
}
for (i=0;i<5;i++)
{
cout<<x[i]<<endl;
}
return0;
}
//wap to find maximum value from 5 element array.
include <iostream>
int main ()
{
int x[5],i,max;
cout<<"Enter 5 value";
for(i=0;i<5i++)
{
cin>>x[i];
}
max=x[0];
for(i=1;i<5;i++)
{
if(x[i]>max)
max=x[i];
}
cout<<" The Maximum value is"<<max;
return 0;
}
//wap to find minimum value from 5 element array.
include <iostream>
int main ()
{
int x[5],i,min;
cout<<"Enter 5 value";
for(i=0;i<5i++)
{
cin>>x[i];
}
min=x[0];
for(i=1;i<5;i++)
{
if(x[i]>min)
min=x[i];
}
cout<<" The Minimum value is"<<min;
return 0;
}