how to find the given number is prime or not?
Answer Posted / shrikanth s.hallikhed
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,flag=0,ctr;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=sqrt(n);ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
getch();
}
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
What is the need of structure in c?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
what is event driven software and what is procedural driven software?
Can you write the function prototype, definition and mention the other requirements.
What is d scanf?
How many data structures are there in c?
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
Array is an lvalue or not?
What is the importance of c in your views?
Explain spaghetti programming?
Is python a c language?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
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
Why string is used in c?
FILE PROGRAMMING