Question #13587

program that will accept the 50 input numbers.after the input process, display all the numbers divisible by 5 from the input.

Expert's answer

#include <iostream>

using namespace std;

void

main()

{

const int NUM_COUNT = 50;

int arr[NUM_COUNT], index =

0;

for(int i = 0; i < NUM_COUNT; ++i)

{

int

number;

cout << "Enter number #" << i + 1 << ":

";

cin >> number;

if (number % 5 == 0 &&

number != 0)

{

arr[index] = number;

index++;

}

}

cout << "Numbers divisible by 5:"

<< endl;

for(int i = 0; i < index; ++i)

{

cout

<< arr[i] << endl;

}

cout << "\n\nEnter 0 for

exit...";

cin >> index;

}

using namespace std;

void

main()

{

const int NUM_COUNT = 50;

int arr[NUM_COUNT], index =

0;

for(int i = 0; i < NUM_COUNT; ++i)

{

int

number;

cout << "Enter number #" << i + 1 << ":

";

cin >> number;

if (number % 5 == 0 &&

number != 0)

{

arr[index] = number;

index++;

}

}

cout << "Numbers divisible by 5:"

<< endl;

for(int i = 0; i < index; ++i)

{

cout

<< arr[i] << endl;

}

cout << "\n\nEnter 0 for

exit...";

cin >> index;

}

## Comments

## Leave a comment