write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / anshul
#include <stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for (i=1;i<=100;i++)
{
k=0;
for (j=1;j<i;j++)
{
if (i%j==0)
{
k++;
}
}
if(k==2)
{
printf("%d \n",i);
}
}
getch();
}
It displays all prime no. from 1 to 100
commants: er.anshul2009@gmail.com
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
What is character constants?
What is null pointer in c?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
Why structure is used in c?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Can you pass an entire structure to functions?
What are the 4 types of organizational structures?
What is the purpose of macro in C language?
What is adt in c programming?
What is the purpose of sprintf() function?
What are the main characteristics of c language describe the structure of ac program?
Can one function call another?
What is a macro?
Compare array data type to pointer data type
When is a “switch” statement preferable over an “if” statement?