Sequence in Prime number

below is the code which tells that the entered number is prime or not
but i want a sequence code which also print all the numbers which are divided
for example if user enter 12 then it should give output that
"
2,3,4,6
not a prime number
"


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 #include<stdio.h>
#include<conio.h>

void main()
{

clrscr();
int a=0,b=0,flag=0;
printf("Enter any number:"); scanf("%d",&a);
for(int c=2;c<a;c++)
{
 b=a%c; if(b==0) { flag=1; }
 }
 if(flag==0)
 { printf("Prime");
 }
 else
 { printf("Not Prime");
 }
 getch();
 }
closed account (48T7M4Gy)
http://www.cplusplus.com/forum/beginner/195127/
Topic archived. No new replies allowed.