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 / sahil and dipanshu

#include<stdio.h>
#include<iostream.h>

int main()
{
int i,j,k,num;
num=5;
for(i=1;i<=num;i++)
{
for(j=1;j<num-i;j++)
{
cout<<" ";
}
for(k=1;k<=i;k++)
{
cout<<k;
}
for(k=i;k>1;k--)
{
cout<<k-1;
}
cout<<endl;
}
return 0;
}

Is This Answer Correct ?    21 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by normalization of pointers?

1106


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1195


In a switch statement, explain what will happen if a break statement is omitted?

1129


Explain what is wrong with this program statement?

1160


What are different storage class specifiers in c?

1139


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

1171


Is that possible to store 32768 in an int data type variable?

1139


Explain what is meant by high-order and low-order bytes?

1095


What are runtime error?

1181


How do you write a program which produces its own source code as output?

1176


Is Exception handling possible in c language?

2103


What is a scope resolution operator in c?

1331


How can I direct output to the printer?

1376


Does c have circular shift operators?

1304


In a switch statement, what will happen if a break statement is omitted?

1121