Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int prost(int n)
- {
- int j,br=0;
- for(j=2;j<n;j++)
- {
- if(n%j==0)
- br++;
- }
- if(br==0) return 1;
- else return 0;
- }
- int suma(int n)
- {
- int s=0,c;
- while(n)
- {
- c=n%10;
- s+=c;
- n/=10;
- }
- return s;
- }
- int main()
- {
- int i;
- for(i=1; i<=10000; i++)
- {
- if(prost(i)==1 &&suma(prost(i)==1))
- printf("%d\t", i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement