Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / jigar

#include<stdio.h>
#include<conio.h>
void main()
{
int a,n,f;
clrscr();
for(n=1;n<=100;n++)
{
f=0;

for(a=2;a<n;a++)
{
if(n%a==0)
{
f=1;
break;
}
}
if(f==0)
printf("%d",n);
}
getch();
}
// JIGAR SHOBHANA (ANIDA VACHHARA-GONDAL)

Is This Answer Correct ?    4 Yes 7 No

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

Answer / anshul

#include <stdio.h>
#include<conio.h>

void main()
{
int i,j,k;
for (i=1;i<=100;i++)
{
k=0;
for (j=1;j<i;j++)
{
if (i%j==0)
{
k++;
}
}
if(k==2)
{
printf("%d \n",i);
}
}
getch();
}
It displays all prime no. from 1 to 100
commants: er.anshul2009@gmail.com

Is This Answer Correct ?    4 Yes 7 No

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

Answer / sureshbobra

#include<stdio.h>
#include<conio.h>
main()
{
int flag,i,j;
clrscr();
for(i=1;i<=100;i++)
{
flag=0;
for(j=2;j<=i;j++)
{
if(i%j==0)
{
flag++;
}
}
if(flag==1)
printf("%d\t",i);
}
getch();
}

Is This Answer Correct ?    2 Yes 6 No

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

Answer / shabeer v c

def shaf(n):
l=range(3,n+1,2)
mi=n
i=0
r=0
print l
while l[i]<n-1:

for j in range(2,l[i]):
if l[i]%j==0:
r=5
if r==0:
print l[i]


r=0
i=i+1


if __name__ == "__main__":
print "prime numbers from 2 to <101 "
shaf(100)

Is This Answer Correct ?    21 Yes 46 No

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

Answer / karthik

void main()
{
int i,j,m;
for(i=1;i<=100;i++
{
m=0
for(j=1;j<i;j++)
{
if(i%j==0)
m++;
}
if(m==0)
printf("%d",i);
getch();
}

Is This Answer Correct ?    54 Yes 87 No

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

Answer / sathya

#include<iostream.h>
void main()
{
int n,a;
cout<<"enter the limit";
cin>>n;
for(i=1;i<=n;i++}
{
if(i=1)
{
cout<<"1 is neither a prime nor a composite no";
}
else if(i%1==0|i%i==0)
{
cout<<i<<"is a prime number";
}
}
}

Is This Answer Correct ?    63 Yes 165 No

Post New Answer

More C Interview Questions

Study the Following Points: a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static 1. Which of the Following Statements are true w.r.t Bit- Fields A)a,b&c B)Only a & b C)Only c D)All

3 Answers   Accenture,


Difference between for loop and while loop?

1 Answers  


what is a constant pointer in C

0 Answers  


I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.

1 Answers  


Explain how do you list a file’s date and time?

0 Answers  


What are the two types of functions in c?

0 Answers  


main() { int i; printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i)); } ans is 24 bt how?pls tell smbody............

3 Answers  


all c language question

0 Answers   Wipro,


Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?

1 Answers   IBM,


get any number as input except 1 and the output will be 1.without using operators,expressions,array,structure.don't print 1 in printf statement

3 Answers  


How does memset() work in C?

2 Answers  


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

0 Answers  


Categories