判断固定范围内的一组数中含有7或者是7的倍数的数

来源:互联网 发布:程序员需要学什么语言 编辑:程序博客网 时间:2024/05/19 18:42
#include <iostream>using namespace std;int main (){int i,FN, N;cout<<"Please  enter first number:";cin>>FN;cout<<"Please  enter second number:";cin>>N;if (FN>=N){cout<<"ERROR ENTER"<<endl;system("pause");return 0;}for(i=FN;i<=N;i++){if(i%7==0){cout<<i<<endl;}else{int temp = i;while(temp>0){if(temp%10==7)        {       cout<<i<<endl;   break;    }temp = temp /10;     }    }     }    system("pause");}

0 0