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
Why is c called a structured programming language?
Write a program with dynamically allocation of variable.
Difference between linking and loading?
What is equivalent to ++i+++j?
Explain what is the most efficient way to store flag values?
Is c is a low level language?
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)
What is printf () in c?
Why header file is used in c?
What is the difference between if else and switchstatement
Is array a primitive data type in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
while initialization of array why we use a[][2] why not a[2][]...?
What is huge pointer in c?