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

what is difference between procedural language and functional language ?

4 Answers   Wipro,


mplementation of stack using any programing language

1 Answers   Marlabs,


Explain the red-black trees?

0 Answers  


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

0 Answers  


#include <stdio.h> void main() { int i=-1,j=1,k,l; k=!i&&j; l=!i||j; printf ("%d%d",k,l) ; }

3 Answers   SRG,


What is scope rule of function in c?

0 Answers  


number 2 plssssss help !!....using array.. turbo c.. create a program that will accept a number and determine if it is a happy number or an unhappy number.. example: enter a number : 7 7*7=49 then 4 and 9 4*4 and 9*9== 16 + 18 gives you 97 then 9 and 7 9*9 and 7*7 == 81 + 49 gives you 130 then 1 and 3 1*1 and 3*3 == 1 + 9 gives you 10 1*1 gives you 1 sample output: 7= 49= 16+81= 97= 81+49=130 =1+9=10 =1 "7 is a happy number" . if the last number is 2 then the number being inputed is not a happy number.

3 Answers  


How do you write a program which produces its own source code as its output?

2 Answers  


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

0 Answers  


Is int a keyword in c?

0 Answers  


What are the types of pointers in c?

0 Answers  


which one low Priority in c? a)=,b)++,c)==,d)+

10 Answers  


Categories