write the program for prime numbers?

Answer Posted / naseer

main(){
int no,i,count=0;
printf("enter any no");
scanf("%d",&no);
//the main logic is here
for(i=2;i<no;i++){

if(no%2==0){
count++;
}
}
if(count>=1)// if the no is less than
//5 then it shows prime
{
printf("not Prime");
}

else
printf("prime");

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is wrong in this statement?

632


Why do we write return 0 in c?

553


Explain how do you determine the length of a string value that was stored in a variable?

670


Write a program to reverse a string.

636


please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics

2856






Who invented b language?

913


How will you declare an array of three function pointers where each function receives two ints and returns a float?

777


Explain what is the concatenation operator?

626


For what purpose null pointer used?

606


Why do some versions of toupper act strangely if given an upper-case letter?

632


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

615


Is sizeof a keyword in c?

578


What is the difference between volatile and const volatile?

562


When should the register modifier be used? Does it really help?

612


What is getch c?

851