Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / ayas kumar das
#include"stdio.h"
int main()
{
int i,j,n;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;)
{
printf("%d",j-1);
j=j-1;
}
}
printf("\n");
}
return 0;
}
| Is This Answer Correct ? | 12 Yes | 20 No |
Post New Answer View All Answers
what are # pragma staments?
Is c++ based on c?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is a program?
How can I direct output to the printer?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
Should a function contain a return statement if it does not return a value?
What is the difference between volatile and const volatile?
What are enums in c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
What are multibyte characters?
how logic is used
What is the difference between far and near in c?
How to write c functions that modify head pointer of a linked list?