Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Liet kê tat ca uc so cua so nguyên duong n.
- // Khai bao thu vien
- #include<stdio.h>
- #include<conio.h>
- int soNT(int n);
- void main()
- {
- int n;
- scanf("%d",&n);
- for(int i=1;i<=n;i++)
- {
- if(n%i==0)
- if(soNT(i)==1)
- printf("%d\t",i);
- }
- }
- int soNT(int n)
- {
- int dem=0;
- for(int i=1;i<=n;i++)
- {
- if(n%i==0)
- dem++;
- }
- if(dem==2)
- return 1; // la so nguyen to
- else
- return 0; // khong la so nguyen to
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement