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 in c to print
1
121
12321
1234321
123454321

Answer Posted / vivek raghuwanshi

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,num;
cout<<num;
for(i=1;i<=num;i++)
{
for(j=1;j<i-1;j++)
{
cout<<" ";
}
for(k=1;k<i;k++)
{
cout<<k;
}
for(k=i;k>=1;k--)
{
cout<<k;
}
}
}

Is This Answer Correct ?    13 Yes 31 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a char in c?

1042


What is the use of void pointer and null pointer in c language?

1171


Can we initialize extern variable in c?

1185


Write a program to swap two numbers without using a temporary variable?

1181


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

4369


Describe newline escape sequence with a sample program?

1173


What is output redirection?

1283


What is n in c?

1114


What does 2n 4c mean?

1313


Explain how can a program be made to print the line number where an error occurs?

1285


Is python a c language?

1057


How do you search data in a data file using random access method?

1362


Explain void pointer?

1100


What does char * * argv mean in c?

1123


What is the basic structure of c?

1158