write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int m,flag;
printf("enter the numbers upto which you wannt to find the prime numbers :");
scanf("%d",&m);
for(int i=1;i<=m;i++)
{
flag=1;
for(int j=2;j<=i/2;j++)
{
if(i%j==0)
flag=0;
}
if(flag==1)
printf("\n%d",i);
}
getch();
}


thank u

Is This Answer Correct ?    49 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is c called a structured programming language?

686


Write a program with dynamically allocation of variable.

612


Difference between linking and loading?

699


What is equivalent to ++i+++j?

648


Explain what is the most efficient way to store flag values?

702






Is c is a low level language?

568


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1633


What is printf () in c?

584


Why header file is used in c?

583


What is the difference between if else and switchstatement

1320


Is array a primitive data type in c?

585


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

630


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

766


while initialization of array why we use a[][2] why not a[2][]...?

1872


What is huge pointer in c?

589