#include <iostream>
using namespace std;
int Is4(int n)
{
while (n > 0)
if (n % 10 == 4) return 1;
else n = n / 10;
return 0;
}
int main()
int k;
cin >> k;
for(int i = 1; i<=k; i++)
if (Is4(i) == 0)
cout << i << " ";
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int Is4(int n)
{
while (n > 0)
if (n % 10 == 4) return 1;
else n = n / 10;
return 0;
}
int main()
{
int k;
cin >> k;
for(int i = 1; i<=k; i++)
if (Is4(i) == 0)
cout << i << " ";
return 0;
}