write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / satwant singh
#include<stdio.h>
#include<conio.h>
void main()
{
long int a,b,i;
clrscr();
printf("enter start no");
scanf("%ld",&a) ;
printf("enter last no");
scanf("%ld",&b);
for(i=a;i<=b;i++)
{
if((i%2==0)||(i%3==0)||(i%5==0)||(i%7==0))
{
//printf("not prime==%ld",i);
}
else
printf("its prime==%ld\n",i);
}
getch();
}
| Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Define the scope of static variables.
What is equivalent to ++i+++j?
Does * p ++ increment p or what it points to?
What is volatile c?
What is a static function in c?
What is LINKED LIST? How can you access the last element in a linked list?
Explain enumerated types in c language?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
What is the difference between int main and void main in c?
What is #include cctype?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80
Difference between macros and inline functions? Can a function be forced as inline?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }