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
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
What are linked lists in c?
What are qualifiers?
difference between native and cross compilers
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
Why do we use int main?
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)
explain what are actual arguments?
What is meant by preprocessor in c?
Write a program which returns the first non repetitive character in the string?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Explain union. What are its advantages?
can we implement multi-threads in c.
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What are lookup tables in c?