please give code for this 1 2 4 7 11 16

Answer Posted / kiran

#include<stdio.h>
#include<conio.h>
void main()
{
int p=1;
for(int i=1;i<=5;i++)
{
printf("%d ",p);
p+=i;
}
getch();
}

Is This Answer Correct ?    34 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is %d used in c?

567


What is the use of the function in c?

598


what is bit rate & baud rate? plz give wave forms

1519


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

1631


How do you construct an increment statement or decrement statement in C?

743






How do you use a pointer to a function?

635


Explain what are the standard predefined macros?

651


What is string concatenation in c?

568


What is an example of structure?

588


What is the -> in c?

585


What are linker error?

614


What does %p mean?

593


What do you understand by friend-functions? How are they used?

645


What are the types of data files?

729


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;ia1[i+1]) && (a2[i]>a2[i+1]) ) ) return false; } return true;//assumed that each array doesn't contain duplicate elements in themshelves }

2712