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 pgm to print
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1

Answers were Sorted based on User's Feedback



write a pgm to print 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1..

Answer / nisrar

void main()
{
int i,j,k,m;
for(i=1;i<=4;i++)
{
for(j=4;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%d",k);
}
for(m=i;m>1;m--)
{
printf("%d",m-1);
}
printf("\n");
}
}

Is This Answer Correct ?    7 Yes 0 No

write a pgm to print 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1..

Answer / siva kumar kalamraju

#include <stdio.h>
void fun(int num)
{
int i;
int max=1,spaces=0;

spaces=num*2;

while(max<=num)
{

for(i=1;i<=spaces;i++)
{
printf(" ");
}
for(i=1; i<=max; i++)
printf("%d ",i);
for(i=(max-1);i>0;i--)
printf("%d ",i);
printf("\n",i);
max++;
spaces=spaces-2;
}
//recursivefun(max+1);
}

int main()
{
int Number;
printf("Enter a Number:");
scanf("%d",&Number);
fun(Number);

getch();
}

Is This Answer Correct ?    5 Yes 4 No

write a pgm to print 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1..

Answer / nisrar

void main()
{
int i,j,k,m;
for(i=1;i<=4;i++)
{
for(j=4;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%d",k);
}
for(m=i;m>1;m--)
{
printf("%d",m-1);
}
printf("\n");
}
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

Explain what’s a signal? Explain what do I use signals for?

0 Answers  


Create a simple code fragment that will swap the values of two variables num1 and num2.

0 Answers  


write a program that will print %d in the output screen??

9 Answers   Infosys,


why should i select you?

21 Answers   Wipro,


What is a wrapper function in c?

0 Answers  


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

0 Answers  


Explain how do you declare an array that will hold more than 64kb of data?

0 Answers  


please send me papers for Dy. manager IT , PNB. it would be a great help for me.

0 Answers  


What is time complexity c?

0 Answers  


if a person is buying coconuts of Rs10,and then sell that coconuts of Rs9,with the loss of one rupee.After that the person became a millaniore.how?

9 Answers   Wipro,


Explain what is the difference between declaring a variable and defining a variable?

1 Answers  


write a program that will read the temperature in Celsius and convert that into Fahrenheit.

1 Answers  


Categories