write a c++ program that gives output
4
3 4
2 3 4
1 2 3 4 using looping statement
Answer Posted / rajesh
This answer is to print :
4
34
234
1234
#include<stdio.h>
int main()
{
int i, space, num, n=4;
for(i=1; i<=n; i++)
{
for(space=1; space<=n-i; space++)
{
printf(" ");
}
for(num=space; num<=n; num++)
{
printf("%d",num);
}
printf("\n");
}
printf("\n");
}
| Is This Answer Correct ? | 2 Yes | 9 No |
Post New Answer View All Answers
Why is c++ still popular?
What's the most powerful programming language?
What is format for defining a structure?
How a modifier is similar to mutator?
What is an adjust field format flag?
What is the best book for c++ beginners?
What is a pointer how and when is it used?
What is c++ and its features?
What is polymorphism in c++? Explain with an example?
Can a program run without main function?
What is a dynamic binding in c++?
Where must the declaration of a friend function appear?
What is pure virtual function?
How to declare an array of pointers to integer?
What is a catch statement?