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 / satwant singh

#include<stdio.h>
#include<conio.h>
void main()
{
long int a,b,i;
clrscr();
printf("enter start no");
scanf("%ld",&a) ;
printf("enter last no");
scanf("%ld",&b);
for(i=a;i<=b;i++)
{
if((i%2==0)||(i%3==0)||(i%5==0)||(i%7==0))
{
//printf("not prime==%ld",i);
}
else
printf("its prime==%ld\n",i);
}

getch();

}

Is This Answer Correct ?    5 Yes 5 No

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

Answer / prasad avunoori

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace primeNumber
{
class Program
{

static void Main(string[] args)
{
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)
{

Console.WriteLine(i);
s++;

}


} Console.WriteLine("There are " +s);
Console.ReadLine();
}
}
}

Is This Answer Correct ?    4 Yes 4 No

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

Answer / siva

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

Is This Answer Correct ?    1 Yes 1 No

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

Answer / shravani

void main()
{
int i,num=1;
clrscr();

while(num<=100)
{ i=2; while(i<=num)
{ if(num%i==0)
break;
i++; }
if(i==num)
printf("\n%d is Prime",num);
num++;
}
getch();
}

Is This Answer Correct ?    1 Yes 1 No

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

Answer / paras patel

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

int divide(int x ,int y)
{
while(x>y)
{
x-=y;
}

if(x==y)
{
x=0;
}
return x;

}

void main()
{
int c,i,n;
scanf("%d",&n);
clrscr();
for( i=2;i<=n;i++)
{
if(divide(n,i)==0)
{
break;
}

}
if(i!=n)
{
printf("not prime");
}
else
{
printf("prime");
}




getch();
}

Is This Answer Correct ?    16 Yes 17 No

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

Answer / bobby shankar

///Prime Number between 1 to n number
int Prime(int init ,int final)
{
int i;
while(init <= final)
{
i=2;
while(i<init)
{
if(init%i==0)
break;
i++;
}
if(i==init)
printf("\n %d is Prime number",init);
init++;
}
}
int main()
{
int inital,final;
printf("\n Enter your Range followed by space separater
e.g 3 30 : ");
scanf("%d %d",&inital,&final);
Prime(inital,final);
getch();
return 1;
}

Is This Answer Correct ?    1 Yes 2 No

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

Answer / gurpreet

pls explain me the logic of the code of printing n prime
numbers........
plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz..................................

Is This Answer Correct ?    0 Yes 1 No

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

Answer / mnagal bhaldare

#include<stdio.h>
#include<conio.h>
int i;
i=1;
for(i=1;i<=100;i++)
{
if(i%2==0)
printf("The prime numbers are%d",i);
else
printf("These are not a prime numbers %d",i);
}

Is This Answer Correct ?    0 Yes 1 No

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

Answer / nikhil

#include<stdio.h>
#include<conio.h>
void main()
{
int m,flag;
flag=0;
for(int i=2;i<100;i++)
{
for(int j=1;j<i;j++)
{
if(i%j==0)
{flag++;
}
}
if(flag==2)
{printf("it is prime %d",i);
}

}
getch();
}

Is This Answer Correct ?    0 Yes 1 No

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

Answer / shailesh singh

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

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

Is that possible to add pointers to each other?

0 Answers  


Is it better to use malloc() or calloc()?

0 Answers   Aspire, Infogain,


What is meant by preprocessor in c?

0 Answers  


Write a program to find minimum between three no.s whithout using comparison operator.

4 Answers   IBM,


What is the most efficient way to store flag values?

0 Answers  


What will be the output of following program #include main() { int x,y = 10; x = y * NULL; printf("%d",x); }

1 Answers  


What is dynamic dispatch in c++?

0 Answers  


Can i use “int” data type to store the value 32768? Why?

0 Answers  


write a c program in such a way that if we enter the today date the output should be next day's date.

0 Answers  


How can I call a function with an argument list built up at run time?

0 Answers  


When should the volatile modifier be used?

0 Answers  


What are signals in C?

2 Answers  


Categories