Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- void podzielnosc(int dlugosc, int dzielnik)
- {
- int a;
- if(dlugosc==1){
- a=0;
- }
- else{
- a=pow(10, dlugosc-1);
- }
- int b=pow(10, dlugosc);
- bool check=true;
- int i=1;
- while(check)
- {
- if(dzielnik*i>=a && dzielnik*i<b){
- cout <<dzielnik*i<<endl;
- i++;
- }
- if(dzielnik*i<a){
- i++;
- }
- if(dzielnik*i>=b){
- check=false;
- }
- }
- }
- int main()
- { //Czasami może wystąpić błąd kompilatora i nie wyświetlą się pewne liczby
- int a, b;
- cout<<"Podaj ilocyfrowe liczby Cie interesuja: ";
- cin>>a;
- cout<<"Podaj, przez co maja byc podzielne: ";
- cin>>b;
- cout<<"Twoje liczby to: "<<endl;
- podzielnosc(a, b);
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement