Write a program to produce the following output:
1
2 3
4 5 6
7 8 9 10
Answer Posted / ashok kumar
void main()
{
int n,i,j,k=1;
clrscr();
printf("\n Enter a number : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=i;j<n;j++)
printf(" ");
for(j=1;j<=i;j++)
printf(" %d ",k++);
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 31 Yes | 19 No |
Post New Answer View All Answers
What is the advantage of an array over individual variables?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is malloc and calloc?
can anyone please tell about the nested interrupts?
What are actual arguments?
Where static variables are stored in memory in c?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
What are the types of operators in c?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
When should we use pointers in a c program?
What is the purpose of void pointer?
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.
Why we use break in c?
Explain what math functions are available for integers? For floating point?
What is an expression?