Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / vidyullatha

#include<stdio.h>

main()
{
int i=0,k=0,l=0;
int cnt=1;
int space=7;
for (i=4;i>0;i--)
{
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
for(k=0;k<space;k++)
{
printf(" ");
}
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
cnt++;
space=space-2;
printf("\n");
}
for(i=0;i<9;i++)
{
printf("0 ");
}
printf("\n");
cnt=7;
for(i=1;i<=4;i++)
{
for(k=0;k<i;k++)
printf(" ");
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
printf("\n");
cnt=cnt-2;
}
}

Is This Answer Correct ?    19 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is scope of variable in c?

991


Write a code on reverse string and its complexity.

981


What are structural members?

954


What are the advantage of c language?

1004


Which header file is used for clrscr?

999


What is spaghetti programming?

1072


How are Structure passing and returning implemented by the complier?

1106


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2500


Explain what is the benefit of using enum to declare a constant?

1020


What are directives in c?

926


What does c mean before a date?

1105


What is the use of bit field?

1117


How do we print only part of a string in c?

974


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

1043


What are data types in c language?

1012