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


Please Help Members By Posting Answers For Below Questions

Can I learn c++ without c?

758


What are arrays c++?

726


What problems might the following macro bring to the application?

705


What is the header file for setw?

687


Why pointer is used in c++?

708






What do you mean by enumerated data type?

655


What is the difference between global int and static int declaration?

503


What c++ library is string in?

691


What is an adjust field format flag?

762


Show the declaration for a static function pointer.

661


What is vector processing?

766


What are 2 ways of exporting a function from a dll?

714


What is function overriding in c++?

685


Why do we use the using declaration?

773


Define the process of handling in case of destructor failure?

669