write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / paras patel
#include <stdio.h>
#include <conio.h>
int divide(int x ,int y)
{
while(x>y)
{
x-=y;
}
if(x==y)
{
x=0;
}
return x;
}
void main()
{
int c,i,n;
scanf("%d",&n);
clrscr();
for( i=2;i<=n;i++)
{
if(divide(n,i)==0)
{
break;
}
}
if(i!=n)
{
printf("not prime");
}
else
{
printf("prime");
}
getch();
}
Is This Answer Correct ? | 16 Yes | 17 No |
Post New Answer View All Answers
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.
What is dynamic dispatch in c++?
What is c variable?
Should I learn c before c++?
What is function prototype?
Are pointers integers in c?
What is nested structure in c?
What is the best way of making my program efficient?
Explain the advantages and disadvantages of macros.
How to write a code for implementing my own printf() and
scanf().... Please hep me in this... I need a guidance...
Can you give an coding for c... Please also explain about
the header files used other than #include
What is table lookup in c?
i got 75% in all semester am i eligible for your company
How can I sort a linked list?