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 |
Why do we need volatile in c?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
What is difference between && and & in c?
What is a memory leak in structures? How can we rectify that?
write a program to display the numbers having digit 9 in the given range from 1 to 100
how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--);
I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed
why programs in c are running with out #include<stdio.h>? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }
what is the output of below pgm? void main() { int i=0; if(i) printf("pass"); else printf("fail"); }
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What is anagram in c?