#include <iostream>
using namespace std;
int main ()
{
int count=0;
int ar [7];
for (int i=100; i<=999; i++)
if ((i%(i%10)==0)&&(i%((i%100-i%10)/10)==0)&&(i%((i-i%100)/100)))
ar[count]=i;
count++;
}
if (count==7)
break;
for (int i=0; i<=6; i++)
cout<<ar[i]<<" ";
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main ()
{
int count=0;
int ar [7];
for (int i=100; i<=999; i++)
{
if ((i%(i%10)==0)&&(i%((i%100-i%10)/10)==0)&&(i%((i-i%100)/100)))
{
ar[count]=i;
count++;
}
if (count==7)
break;
}
for (int i=0; i<=6; i++)
cout<<ar[i]<<" ";
return 0;
}