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...


how can write all 1to 100 prime numbers using for loop,if and
break ?

Answers were Sorted based on User's Feedback



how can write all 1to 100 prime numbers using for loop,if and break ?..

Answer / sandeep

#include<stdio.h>
main()
{
int a=2;

work:
printf("%d",a);
a=a+2;
check:
if(a<=100)
goto work;

}

Is This Answer Correct ?    1 Yes 0 No

how can write all 1to 100 prime numbers using for loop,if and break ?..

Answer / divyanshu

#include<iostream.h>
#incude<conio.h>
int main()
{
int x=100,i,p=1;
cout<<"enter the no.";
cin>>x;
for(i=2;i<x;i++)
{
if(x%i==0)
{
p=2;
break;
}
if(x==1)
{
cout<<"prime no.";
}
getch();
}

Is This Answer Correct ?    2 Yes 12 No

Post New Answer

More C Interview Questions

What is difference between constant pointer and constant variable?

0 Answers   Hexaware,


What is structure and union in c?

0 Answers  


what is difference between array of characters and string

18 Answers   Accenture, Nest,


please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................

0 Answers  


How to write a program to receive an integer & find its octal equivalent by using for loop?

1 Answers   Google,


Which of these functions is safer to use : fgets(), gets()? Why?

0 Answers  


Explain the Difference between the New and Malloc keyword.

0 Answers   InterGraph,


Why use int main instead of void main?

0 Answers  


What does sizeof return c?

0 Answers  


what is compiler

7 Answers  


what is void pointer?

2 Answers  


Which is an example of a structural homology?

0 Answers  


Categories