12344321
123 321
12 21
1 1 how i print this program??
Answer Posted / vamsi talapatra
#include<iostream>
using namespace std;
int main(){
int n = 4;
while(n>0){
for(int i = 1; i<=n; i++){
cout<<i;
}
cout<<" ";
for(int i = n; i>0; i--){
cout<<i;
}
n--;
cout<<endl;
}
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is non linear data structure in c?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What is the difference between abs() and fabs() functions?
Explain what does it mean when a pointer is used in an if statement?
What oops means?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
What is calloc()?
What are runtime error?
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
Why does everyone say not to use gets?
What are the characteristics of arrays in c?
How many keywords are there in c?
Write a program to use switch statement.
Does c have class?