# Java Programing

Sourabh Luniya
Java Programing
2 Answer(s)      5 years and 9 months ago
Posted in : Java Beginners

I)WAP to print following series: 1) 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 2) (5!/x)+(10!/xx)+(15!/xx*x)+.....n terms.

II)Write a menudriven program to perform the following as long as user wants: a) Convert decimal number to binary number. b) Convert binary number to decimal number.

February 1, 2012 at 1:03 PM

```import java.io.*;
class Pyramid{
public static void main(String args[]){
int x,y;
int rows = 4;
for (y = 1; y <= rows; ++y) {
for (x = y; x < rows; ++x) {
System.out.print(" ");
}
for (x = 0; x < y; ++x) {
System.out.print((y+x) % 10);
}
for (x = y - 1; x > 0; --x) {
System.out.print((y+x-1) % 10);
}
System.out.println();
}

}
}
```

February 1, 2012 at 1:18 PM

```import java.util.*;
{
public static void main(String[] args)
{
boolean exit=false;
Scanner input=new Scanner(System.in);
System.out.println("1 Convert Decimal to Binary");
System.out.println("2 Convert Binary to Decimal");
System.out.println("3 Exit");
do{
System.out.print("Enter your choice: ");
int choice=input.nextInt();
switch(choice){
case 1:
System.out.print("Enter Decimal Number: ");
int i = input.nextInt();
String bi = Integer.toBinaryString(i);
System.out.println("Binary of "+i+" is: "+bi);
break;

case 2:
System.out.print("Enter Binary Number: ");
String str = input.next();
int binary= Integer.parseInt(str,2);
System.out.println("Decimal of "+str+" is: "+binary);
break;

case 3:
exit=true;
System.exit(0);
break;
}
}
while(!exit);
}
}
```

Related Tutorials/Questions & Answers:
Java programing
Java programing   need help wrting this Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter). thanks
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
java programing
java programing  reverse a multidigit number using recursive definition
java programing
java programing  write a program to input a number or find & print the highest digit
java programing
java programing  write a program to input a number or find & print the highest digit. example:-2639 than print 9
java programing
java programing  Integers from 0 to X stored in an array of size X+1. Each integer appears once & only once, but in random order e.g. Consider array of size 5 as below... Arr[0]=3; Arr[1]=0; Arr[2]=1; Arr[3]=4; Arr[4]=2
Java Programing
Java Programing  I)WAP to print following series: 1) 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 2) (5!/x)+(10!/xx)+(15!/xx*x)+.....n terms. II)Write a menudriven program to perform the following as long as user
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT  I WANT TO KNOW ABOUT THE JAVA SOCKET PROGRAMING FROM BASIC LEVEL AND HOW CAN I WORK ON IT I KNOW THE JAVA PROGRAMING.SO PLEASE HELP ME HOW CAN I DO SOCKET PROGRAMING
Java programing help
Java programing help  Can you help me create this program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign
java programing problem - Java Beginners
java programing problem  Create a class named Movie that can be used with your video rental business. The Movie class should track the Motion picture Association of America rating , ID Number, and movie title with appropriate
java programing - Java Beginners
java programing  What is java program coading to convert a mp3 file to it binary equivalent
java programing - Java Beginners
java programing  How to Design and create a java class for address book object that contains a person's name, home address and phone number..., and pager. Write a java GUI application to add, edit,delete and find the address
java programing - Java Beginners
java programing  hi!! I Wish i am welcome in this site. As You can see i am trying to teach my self how to program using java language and manually is by not using the function in java language. please help me
Java Programing - Java Beginners
Java Programing  I used setMnemonic method to put shortcut key...); } } --------------------------------------------------- Visit for more information. http://www.roseindia.net/java/example/java/swing/ Thanks
java programing - Java Beginners
java programing  Write a program that reads numbers fromthe keyboard into an array of type int[]. You may assume that there will be 50 or fewer entries in the array .Your program allows any numbers of numbers to be entered , up
java IO programing
java IO programing  how Java source file is used as input the program will echo lines
Java programing - Development process
Java programing  1.What is system.out and system.in? 2.write down the steps to run Java application 3.what are the function of the following methods a.show input dialogue message. b.show output dialogue message
java programing - JDBC
java programing  A retail company has got the records of its customers which contains name, home address and phone number, business address and phone number, and numbers for their fax machine, cellular phone, and pager, marital
beginning java programing
beginning java programing  Hi. I am trying to write a piece of code that not allow a duplicate item to be added to the list (and allow for either upper or lowercase names). But the same name keep adding onto the list. Can someone
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
programing
programing  Using Java, Design a simple interface that can capture information of your choice with the following controls; Labels, Text Fields, Checkbox, Radio buttons and command buttons. You may have to use the following files
programing question
programing question  how do i use loops(for,while) to add components in java   Hi Friend, The below code might help you. import java.awt.*; import javax.swing.*; class TextFieldArray extends JFrame{ JLabel l[]=new
socket programing in servlet
socket programing in servlet  give me a example to write socket programing in servlet