Problem 4 from 52 programming problems book

Solution:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int testcase,i,num_range,j;
    cin>>testcase;
    for(i=1; i<=testcase; i++)
    {
        cin>>num_range;
        cout<<"Case "<<i<<":";
        for(j=1; j<=num_range; j++)
        {
            if(num_range%j==0)
            {
                cout<<" "<<j<<" ";
            }
        }
        cout<<endl;
    }
    return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.