greenieM
Technical User
- Feb 20, 2009
- 1
this is what i wrote
could someone tell me where is my mistake?
can i use here flag at all?
#include <stdio.h>
void main ()
{
int arr[10], i, j, flag;
for (i=0;i<10;i++)
scanf ("%d", &arr);
for (i=0;i<10;i++)
{
flag=1;
for (j=2;j<=(arr/2); j++)
{
if (arr%j==0)
{
flag=0;
break;
}
}
}
for (i=0;i<10;i++)
{
if (flag=1)
printf ("%d", arr);
}
}
could someone tell me where is my mistake?
can i use here flag at all?
#include <stdio.h>
void main ()
{
int arr[10], i, j, flag;
for (i=0;i<10;i++)
scanf ("%d", &arr);
for (i=0;i<10;i++)
{
flag=1;
for (j=2;j<=(arr/2); j++)
{
if (arr%j==0)
{
flag=0;
break;
}
}
}
for (i=0;i<10;i++)
{
if (flag=1)
printf ("%d", arr);
}
}