Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int obratenBroj(int broj){
- int temp=0;
- while(broj>0){
- temp=temp*10;
- temp=temp+broj%10;
- broj/=10;
- }
- return temp;
- }
- int sumaNaCifri (int broj){
- int suma=0;
- int temp1=broj;
- while(temp1>0){
- suma+=temp1%10;
- temp1/=10;
- }
- return suma;
- }
- void pecatiVoInterval (int a,int b){
- int i;
- for(i=a;i<=b;i++){
- if((i+obratenBroj(i))%sumaNaCifri(i+obratenBroj(i))==0){
- printf("%d\n", i);
- }
- }
- }
- int main () {
- int a,b;
- scanf("%d %d", &a, &b);
- pecatiVoInterval(a,b);
- return 0;
- }
Add Comment
Please, Sign In to add comment