write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / prasad avunoori
int s=0;
int c,k;
for (int i = 2; i < 100; i++)
{
c = 0;
for (int j = 1; j <= i; j++)
{
if(i%j==0)
{
c = c + 1;
}
}
if (c == 2)
{
printf("%d\n",i);
s++;
}
} printf("There are %d " ,s);
| Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
How to write a code for reverse of string without using string functions?
What is the acronym for ansi?
Write a program to identify if a given binary tree is balanced or not.
What are the different file extensions involved when programming in C?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Is array a primitive data type in c?
Why is %d used in c?
C language questions for civil engineering
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What is the use of bit field?
What are 'near' and 'far' pointers?
What is clrscr ()?
what is the role you expect in software industry?
What does c mean in basketball?
What are different types of variables in c?