write the program for prime numbers?
Answer Posted / ashok
void main()
{
int i,n;
clrscr();
printf("\nEnter the range:");
scanf("%d",&n)
printf("Prime numbers are:");
for(i=1;i<=n;i++)
{
if(i==2 || i==3 || i==5 || i==7)
printf("%d ",i);
if(i%2!=0 && i%3!=0 && i%5!=0 && i%7!=0)
printf("%d ",i);
}
getch();
}
Is This Answer Correct ? | 7 Yes | 8 No |
Post New Answer View All Answers
What is %lu in c?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
What's a good way to check for "close enough" floating-point equality?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
Tell me about low level programming languages.
What is the difference between a string and an array?
Give basis knowledge of web designing ...
Explain the difference between null pointer and void pointer.
What is the right way to use errno?
How can I get back to the interactive keyboard if stdin is redirected?
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i
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?
what is the diffrenet bettwen HTTP and internet protocol
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is the scope of static variable in c?