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
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 |
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 |
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 |
Explain what’s a signal? Explain what do I use signals for?
Create a simple code fragment that will swap the values of two variables num1 and num2.
write a program that will print %d in the output screen??
why should i select you?
What is a wrapper function in c?
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
Explain how do you declare an array that will hold more than 64kb of data?
please send me papers for Dy. manager IT , PNB. it would be a great help for me.
What is time complexity c?
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?
Explain what is the difference between declaring a variable and defining a variable?
write a program that will read the temperature in Celsius and convert that into Fahrenheit.