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

#include<stdio.h>
int main()
{
int a=2,n=4,i,j,k;
for (i=4;i>=0;i--)
{
for(j=0;j<a;j++)
{
printf("%d",n);
}
printf("
");
a=a+2;
n--;

}
n=1;
a=a-4;
for(i=0;i<=4;i++)
{
for(j=0;j<a;j++)
{
printf("%d",n);
}
printf("
");
a=a-2;
n++;
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does c have class?

1181


What is atoi and atof in c?

1145


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

1047


What is the use of pragma in embedded c?

1109


Do you have any idea how to compare array with pointer in c?

1098


Explain what is a static function?

1161


What is main return c?

1050


Explain how can a program be made to print the name of a source file where an error occurs?

1252


What is the explanation for prototype function in c?

1036


What is wrong with this program statement? void = 10;

1316


What is a structural principle?

1246


What is the difference between far and near in c?

1122


What does the error 'Null Pointer Assignment' mean and what causes this error?

1261


What is the use of a conditional inclusion statement in C?

1117


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2372