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


Please Help Members By Posting Answers For Below Questions

What language is lisp written in?

850


What is New modifiers?

886


What is the importance of c in your views?

810


What is the use of a conditional inclusion statement in C?

835


Where in memory are my variables stored?

845


What is meant by int main ()?

947


What is header file in c?

831


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

1723


Tell me when would you use a pointer to a function?

813


Do character constants represent numerical values?

1074


Why we use break in c?

753


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

991


What is difference between static and global variable in c?

760


What is structure packing in c?

818


Why functions are used in c?

834