#include<iostream.h> #include<conio.h> void main() { int a[100],p,s,i,n; clrscr(); cout<<"\nenter size of an array:"; cin>>n; s=a[0]; p=0; cout<<"\nenter the arrray:"; for(i=1;i<n;i++) cin>>a[i]; for(i=1;i<n;i++) { if(a[i]>s) { s=a[i]; p=i; } } cout<<"big="<<s; cout<<"position"<<p; getch(); }
Sunday, 7 December 2014
C++ program to print biggest number in an array with position(index)
Posted by Madan
Posted on 14:33