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
What is static function in c?
What does #pragma once mean?
What does *p++ do? What does it point to?
What is LINKED LIST? How can you access the last element in a linked list?
What are the various types of control structures in programming?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
When should a type cast be used?
Write a factorial program using C.
What is selection sort in c?
What is infinite loop?
Write a program to maintain student’s record. Record should
not be available to any unauthorized user. There are three
(3) categories of users. Each user has its own type. It
depends upon user’s type that which kind of operations user
can perform. Their types and options are mentioned below:
1. Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record)
2. Super Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record, Delete Single Record)
3. Guest
(Search Record [by Reg. No or Name], View All Records)
When first time program runs, it asks to create accounts.
Each user type has only 1 account (which means that there
can be maximum 3 accounts). In account creation, following
options are required:
Login Name: <6-10 alphabets long, should be unique>
Password: <6-10 alphabets long, should not display
characters when user type>
Confirm Password:
Where is volatile variable stored?
Why do we use return in c?
What are the two forms of #include directive?
What is structure in c explain with example?