Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / roshan patil
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,k,num;
cout<<num;
for(i=1;i<=num;i++)
{
for(j=1;j<num-1;j++)
{
cout<<" ";
}
for(k=1;k<i;k++)
{
cout<<k;
}
for(k=i;k>=1;k--)
{
cout<<k;
}
}
}
| Is This Answer Correct ? | 12 Yes | 14 No |
Post New Answer View All Answers
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What is the purpose of the preprocessor directive error?
main() { printf("hello"); fork(); }
What is static memory allocation?
how to execute a program using if else condition and the output should enter number and the number is odd only...
How do you print only part of a string?
Explain how can I avoid the abort, retry, fail messages?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What is c language and why we use it?
to find the closest pair
why return type of main is not necessary in linux
What does typeof return in c?
What is a volatile keyword in c?
Is c pass by value or reference?