write a pgm to print
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
Answer Posted / nisrar
void main()
{
int i,j,k,m;
for(i=1;i<=4;i++)
{
for(j=4;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%d",k);
}
for(m=i;m>1;m--)
{
printf("%d",m-1);
}
printf("\n");
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Is it possible to pass an entire structure to functions?
What is NULL pointer?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
Is c still used?
What is scanf () in c?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
In a switch statement, explain what will happen if a break statement is omitted?
Discuss the function of conditional operator, size of operator and comma operator with examples.
What is the difference between array and structure in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What is variable and explain rules to declare variable in c?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What does %2f mean in c?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Should I learn c before c++?