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
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is equivalent to ++i+++j?
What is the difference between a free-standing and a hosted environment?
What are register variables in c?
What is break statement?
Write a program to check whether a number is prime or not using c?
code for find determinent of amatrix
How are portions of a program disabled in demo versions?
What is the use of extern in c?
What is the use of f in c?
What are the advantages of using linked list for tree construction?
What is call by reference in functions?
Is there anything like an ifdef for typedefs?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
Is printf a keyword?