how can write all 1to 100 prime numbers using for loop,if and
break ?
Answers were Sorted based on User's Feedback
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 |
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 |
how to find sum of 5 digits in C?
if a five digit number is input through the keyboard, write a program to calculate the sum of its digits. (hint:-use the modulus operator.'%')
How to throw some light on the b tree?
Do pointers need to be initialized?
what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }
Place the #include statement must be written in the program?
Under what circumstances does a name clash occur?
What is the basic structure of c?
what are bit fields in c?
What are header files? What are their uses?
Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.