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

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

1203


Is it cc or c in a letter?

1030


Why pointers are used?

1082


Is a house a mass structure?

1103


Explain what are the __date__ and __time__ preprocessor commands?

1133


What functions are used in dynamic memory allocation in c?

1094


What is the best way of making my program efficient?

1040


What is null pointer constant?

1176


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

1113


What is bin sh c?

1050


What is the difference between near, far and huge pointers?

1106


Explain why can’t constant values be used to define an array’s initial size?

1364


Explain what is the heap?

1064


Explain null pointer.

1131


Can a variable be both static and volatile in c?

1053