Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. Stop processing input after reading in the number 42.

 

Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely… rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.






OURSHOPKEEPER










#include <iostream>
using namespace std;
int main()
{
    int na[50];
    n = sizeof(a)/sizeof(a[0]);
        
    for (int i = 0i < ni++)
    {
        cin >> a[i];

        if (a[i] == 42)
        {
            break;
        }
        else
            cout << a[i<< " ";
    }
}







    


Click on the above button to download the code.



Post a Comment

If you have furthur QUERIES please let us know

Previous Post Next Post