write the program for prime numbers?
Answer Posted / chinnakannasabari
#include <stdio.h>
int main (void)
{
int i, nb, count, test;
test = count = 0;
printf ("enter integer: ");
if (scanf ("%d", &nb) != 1)
return -1;
for (i = 2; i < nb; i++, count++)
if (nb % i == 0)
test = 1;
if (!test)
printf ("%d prime number, number of iterations = %dn",
nb, count);
else
printf ("%d is not a prime number, number of iterations
= %dn", nb,count);
return 0;
}
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
please explain every phase in the "SDLC" in the dotnet.
Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250
What is sizeof return in c?
What is the heap in c?
Explain what is the difference between a free-standing and a hosted environment?
what do u mean by Direct access files? then can u explain about Direct Access Files?
I have seen function declarations that look like this
What is a shell structure examples?
What is the difference between malloc() and calloc() function in c language?
Explain the bubble sort algorithm.
What is use of #include in c?
What is a null string in c?
Why static variable is used in c?
Tell me what is null pointer in c?
What is the difference between array and pointer in c?