1
232
34543
4567654
can anyone tell me how to slove this c question
Answer Posted / karthick
public class Num
{
public static void main(String[] args)
{
for(int i=1;i<=9;i++)
{
for(int l=9;l>=i;l--)
{
System.out.print(" ");
}
for(int j=i;j>=1;j--)
{
System.out.print(j);
if(j==1)
{
for(int k=2;k<=i;k++)
{
System.out.print(k);
}
}
}
System.out.println(" ");
}
System.out.println("-------------------");
for(int m=9;m>=1;m--)
{
for(int n=9;n>=m;n--)
{
System.out.print(" ");
}
for(int o=m;o>=1;o--)
{
System.out.print(o);
if(o==1)
{
for(int r=2;r<=m;r++)
{
System.out.print(r);
}
}
}System.out.println("");
}
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is a char in c?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
How are strings stored in c?
Explain the difference between malloc() and calloc() in c?
How does placing some code lines between the comment symbol help in debugging the code?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
What is the benefit of using #define to declare a constant?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
Write a program to swap two numbers without using third variable in c?
Can you mix old-style and new-style function syntax?
What is spark map function?
What are 3 types of structures?
Explain about block scope in c?