Write a program to find whether the given number is prime or
not?
Answer Posted / sudha
#include<stdio.h>
#include<conio.h>
void main()
{
int isprime=1;
int n,i;
printf("enter a number");
scanf("%d",&n);
if(i=2;i<=n/2;i++)
{
if((n%i)==0)
{
isprime=0;
break;
}
}
if(isprime==1)
{
printf("%d is a prime number",n);
}
else
{
printf("%d is not a prime number",n);
}
getch();
}
| Is This Answer Correct ? | 18 Yes | 5 No |
Post New Answer View All Answers
What are the different categories of functions in c?
Can static variables be declared in a header file?
Explain what is the heap?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34
What is %d used for?
What is header file in c?
write a program to print largest number of each row of a 2D array
What is extern keyword in c?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Explain how can a program be made to print the name of a source file where an error occurs?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
Lists the benefits of c programming language?
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
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321