write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / nachiyappan
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c,n=1;
clrscr();
for(i=1;i<=100;i++)
{
n=n+1;
c=0;
for(j=1;j<=n;j++)
{
if(n%j==0)
c=c+1;
}
if(c==2)
printf("no. %d is prime",n);
else
printf("no. %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
Give basis knowledge of web designing ...
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
what are the 10 different models of writing an addition program in C language?
What is new line escape sequence?
What is main function in c?
What are pointers in C? Give an example where to illustrate their significance.
how to find anagram without using string functions using only loops in c programming
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Can you assign a different address to an array tag?
Explain how does flowchart help in writing a program?
Explain what is gets() function?
What is maximum size of array in c?
How does struct work in c?
What is the best way of making my program efficient?