Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- int i, n, sum=0;
- int x[100];
- clrscr();
- cin>>n;
- int j=0;
- for(i=1; i<=n; i++)
- {
- x[j]=i;
- cout<<i<<endl;
- j++;
- sum=sum+i;
- }
- cout<<"sum of n numbers="<<sum<<endl;
- float avg;
- avg=sum/(float)i;
- cout<<"avg="<<avg<<endl;
- int small;
- small=x[0];
- for(i=1; i<=n; i++)
- if(small>x[i])
- {
- small=x[i];
- }
- cout<<"searching---"<<endl;
- cout<<"The smallest value in the given value array is ="<<small<<endl;
- int biggest;
- biggest=x[0];
- for(i=1; i<=n; i++)
- if(biggest<x[i])
- {
- biggest=x[i];
- }
- cout<<"searching---"<<endl;
- cout<<"The biggest value in the given array is ="<<biggest<<endl;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment