Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / arun c s
#include <stdio.h>
main()
{
int i, j, k, space, n=9;
for (i=1; i<=n; i++)
{
for (j=1; j<=n-i; j++)
putchar(' ');
for (j=1,k=2*i-1; j<=2*i-1; j++,k--)
{
if (j <= k)
printf("%d", j);
else
printf("%d", k);
}
putchar('
');
}
getch();
}
Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is the difference between printf and scanf )?
What is the difference between abs() and fabs() functions?
Write a C program in Fibonacci series.
What are the modifiers available in c programming language?
How #define works?
Is c++ based on c?
Why is sprintf unsafe?
What is dynamic dispatch in c++?
write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.
What do you mean by c what are the main characteristics of c language?
Why array is used in c?
What is #error and use of it?
What is a dynamic array in c?
What is keyword with example?