This program takes an integer argument from the command line
This program takes an integer argument from the command line. It prints “yes” if the number is prime, “no” if the number is not prime, and “error” if no input is given. You can assume the input will be a proper integer (> 0). Thus, it will not contain ‘.’ or any letters. The command prompt in the examples below is indicated by ’$’.
Example Execution:
$./first 10
no
$./first 7
yes
$./first
error
In C, not Java please.
Solution
#include<stdio.h>
#include,conio.h>
main()
{
int i,j, n=0;
for (i=2; i<=100;i++)
{
for(j=1;j<=i;j++)
{
if(i%j==0)
n++;
}
if(n==2)
{
printf(\"%d\",i)
}
n=0;
}
}
}
