Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / mohammedayub.y(c.i.e.t)
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,n,k;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=n;k>i;k--)printf(" ");
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;j--)
{
printf("%d",j-1);
}
}
printf("\n");
}
getch();
return 0;
}
| Is This Answer Correct ? | 72 Yes | 28 No |
Post New Answer View All Answers
What is operator promotion?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What is the role of this pointer?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What does dm mean sexually?
Write a c program to demonstrate character and string constants?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
What is pointer to pointer in c?
hi send me sample aptitude papers of cts?
Write program to remove duplicate in an array?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
What is use of integral promotions in c?
Write a program to print fibonacci series using recursion?
What is difference between far and near pointers?