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 swap 3 numbers without using 4th variable?
What is an auto keyword in c?
How can I recover the file name given an open stream?
How does placing some code lines between the comment symbol help in debugging the code?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
/*what is the output for the code*/ void main() { int r; r=printf("naveen"); r=printf(); printf("%d",r); getch(); }
Can 'this' pointer by used in the constructor?
difference between i++* and *++i
Explain the difference between null pointer and void pointer.
What is sizeof c?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Is main() is used in the program,,see below example? void main() { int i; for(i=0;i<10;i++) main(); } Then what is the output of the program?