SAMPLE.C

 #include <stdio.h>
/*GLOBAL VARIABLES*/
#define MAX 10

int A[MAX];
int B;
int I;
int J;
int TEMP;

int PRIME(int V)
{
int T;
T=V/2;
while (V%T>0)
{
T=T-1;
}
if (T==1)
{
return 1;
}
else
{
return 0;
}
}

int ND(int V)
{
int I;
int CNT;
CNT=0;
I=2;
while (I<V)
{
if ((V%I)==0)
CNT=CNT+1;
I=I+1;
}
return CNT;
}

void PRINT()
{
for(I=1;I<=MAX;I++)
{
printf("ELEMENT NO %d", I);
printf(" :%d\n", A[I-1]);
TEMP=ND(A[I-1]);
if (TEMP>1)
if (PRIME(TEMP)==1)
printf(" OK: %d\n", A[I-1]);
}
}


void main()
{
for(I=1;I<=MAX;I++)
{
printf("ENTER ELEMENT NO %d\n", I);
scanf("%d", &A[I-1]);
}

for(I=1;I<=MAX-1;I++)
for(J=MAX-1;J>=I;J--)
{
if (A[J-1]>A[J+1-1])
{
TEMP=A[J-1];
A[J-1]=A[J+1-1];
A[J+1-1]=TEMP;
}
}
PRINT();

}

/* Program converted successfully.*/

Project Homepage: