write a program to display the numbers in the following
format
4 4
3 3 3 3
2 2 2 2 2 2
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1
2 2 2 2 2
3 3 3
4

Answer Posted / bharath_471

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,n;
clrscr();
printf("enter the number");
scanf("%d",&n);
for(j=n,l=1;(j>0 && l<=n);j--,l++)
{
for(k=1;k<=2*l;k++)
printf("%d",j);
printf("
");
}
for(j=0,l=n;(j<=n && l>=0) ;j++,l--)
{
for(k=1;k<=2*l+1;k++)
printf("%d",j);
printf("
");
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is a null pointer different from a dangling pointer?

558


Explain what are the different file extensions involved when programming in c?

635


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5057


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1628


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

641






hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?

1666


can anyone suggest some site name..where i can get some good data structure puzzles???

1643


What is a null string in c?

590


Explain modulus operator.

598


What are the primitive data types in c?

579


What should malloc() do? Return a null pointer or a pointer to 0 bytes?

626


Is there a way to jump out of a function or functions?

637


Is anything faster than c?

587


All technical questions

1512


can any one provide me the notes of data structure for ignou cs-62 paper

1707