Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- void main() {
- int count;
- int greatest = 0;
- int arr[100];
- cout << "enter the number of input you want to execute" << endl;
- cin >> count;
- for (int i = 0; i < count; i++) {
- cout << "enter a number: ";
- cin>>arr[i];
- }
- for (int i = 0; i < count; i++) {
- if (arr[i] > greatest) {
- greatest=arr[i];
- }
- }
- int smallest = arr[0];
- for (int i = 0; i < count; i++) {
- if (arr[i]<smallest){
- smallest = arr[i];
- }
- }
- system("cls");
- cout << "\n\n\n\n";
- cout << "the greatest number is: " << greatest << endl;
- cout << "the smallest number is: " << smallest <<"\n\n\n";
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement