write the program for prime numbers?

Answer Posted / arfu

#include<stdio.h>

int main()
{
int c,i,n;
c=0;
scanf("%d",&a);
for(i=2;i<a;i++)
if (n%i==0)
{
c=1;break;
}
if(c!=1)`("prime");
else printf ("not a prime");
}

Is This Answer Correct ?    110 Yes 89 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What tq means in chat?

596


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

1735


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

692


How does pointer work in c?

632


What is meant by operator precedence?

687






What is an lvalue in c?

703


Explain what is the difference between functions abs() and fabs()?

632


What is this infamous null pointer, anyway?

622


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

928


What are the different data types in C?

736


Why & is used in scanf in c?

635


Explain can static variables be declared in a header file?

691


What are the header files used in c language?

599


What is bash c?

566


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

2255