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
Explain the difference between exit() and _exit() function?
What does typedef struct mean?
What is the -> in c?
What is indirection in c?
Do variables need to be initialized?
Write a function that will take in a phone number and output all possible alphabetical combinations
What do you mean by dynamic memory allocation in c? What functions are used?
What is volatile, register definition in C
What are high level languages like C and FORTRAN also known as?
What is a stream?
What is variable in c example?
write a programming in c to find the sum of all elements in an array through function.
Why enum is used in c?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Explain what is a 'locale'?