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

How was c created?

589


Explain what is the difference between a string and an array?

638


Can the “if” function be used in comparing strings?

593


What are the 3 types of structures?

570


A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

1775






What does the message "automatic aggregate intialization is an ansi feature" mean?

694


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

622


What do you mean by dynamic memory allocation in c? What functions are used?

654


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

1655


Why isn't any of this standardized in c? Any real program has to do some of these things.

623


What is c++ used for today?

665


How can you convert integers to binary or hexadecimal?

615


Process by which one bit pattern in to another by bit wise operation is?

615


What is a static variable in c?

665


difference between Low, Middle, High Level languages in c ?

1634