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
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
what is the syallabus of computer science students in group- 1?
Why is main function so important?
Why do we use c for the speed of light?
Define Spanning-Tree Protocol (STP)
What is union in c?
What is scanf () in c?
Why is it that not all header files are declared in every C program?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
Why string is used in c?
What is the best way to comment out a section of code that contains comments?
Write a program to reverse a linked list in c.
Write a code to generate divisors of an integer?
What is array of pointers to string?