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 is the modulus operator?

1216


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

1506


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

1099


What are control structures? What are the different types?

1095


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3315


What is typedef example?

1193


Simplify the program segment if X = B then C ← true else C ← false

3021


how is the examination pattern?

2026


What is union and structure in c?

1233


What is p in text message?

988


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4285


What does void main return?

1129


Can you define which header file to include at compile time?

1023


Is c programming hard?

1034


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3523