print out put like this form
1 2 3 4 5 6
3 5 7 9 11
8 12 16 20
Answer Posted / sanjay bhosale
int *a,n;
printf("\n Enter the number of elements");
scanf("%d",&n);
a = new int[n];
for(int i=0;i<n;i++)
{
a[i] = i+1;
}
printf("\n : Output : \n");
for(int i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
for(int t = n-1;t>0;t--)
{
printf("\n");
for(int i=0;i<t;i++)
{
printf("%d\t",a[i]+a[i+1]);
a[i] = a[i]+a[i+1];
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is difference between arrays and pointers?
What are examples of structures?
What is oops c?
Why we use break in c?
Explain is it valid to address one element beyond the end of an array?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
What does s c mean in text?
What is abstract data structure in c?
What does 3 mean in texting?
How arrays can be passed to a user defined function
What is a example of a variable?
Why is this loop always executing once?
Can you write the function prototype, definition and mention the other requirements.
can we change the default calling convention in c if yes than how.........?
What are the functions to open and close file in c language?