write the program for prime numbers?

Answer Posted / samson mugambi

#include<stdio.h>

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 32 keywords in c?

639


Explain what are the different data types in c?

765


Explain how do you print an address?

661


How are portions of a program disabled in demo versions?

756


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1989






Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

2524


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1128


Why header file is used in c?

582


What is the scope of global variable in c?

560


What is a volatile keyword in c?

645


How is = symbol different from == symbol in c programming?

618


What type is sizeof?

589


What kind of structure is a house?

562


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

741


Is array a primitive data type in c?

584