Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners java code and logic

Have Programming Question? Ask it here!
 
 
 


mariam
java code and logic
2 Answer(s)      4 years and 7 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 7, 2009 at 12:35 PM


Hi Friend,

Try the following code:

class Program {
public static void main(String[] args) {
int i,j,p,n,m,r=1;
m=n=4;
for(int k=1;k<=5;k++){
System.out.print(k);
}
for(int k=4;k>=1;k--){
System.out.print(k);
}
System.out.print("\n");
for(i=1;i<=n;i++) {
for(j=1;j<=m;j++)
System.out.print(j);
System.out.print(" ");
for(p=j-r;p>=1;p--)
System.out.print(p);
m--;
r=1;
System.out.print("\n");
}
}
}

Thanks


October 7, 2009 at 3:10 PM


class Test{
public static void main(String args[])
{
int u=5;
int m=5;
int n=1;
for (int i=1;i<=u;i++)
{
for (int k=n;k<=m;k++)
{
System.out.print(k);
}
System.out.print(" ");
for (int j=m;j>=n;j--)
{
System.out.print(j);
}
System.out.print("\n");
m=m-1;
}

}
}


Related Tutorials/Questions & Answers:
java code and logic - Java Beginners
java code and logic  Q1: how to write java program for the following: * * * * * * * * * * * * * Q2: S T R I
java code and logic - Java Beginners
java code and logic  how to write the program in java for 123454321 1234 4321 123 321 12 21 1 1 thanks  Hi Friend, Try the following code: class Program { public static void main(String
Advertisements
java code and logic - Java Beginners
java code and logic  Q1: PRINT FIRST 100 PRIME NUMBERS? Q2; INPUT A NO. FROM THE USER REVERSE THAT NO. AND INCREMENT IT WITH 1 AND THEN PRINT IT. Q3: HOW TO PRINT THIS STRING s T R
Pleae help me to give logic and code for this program - Java Beginners
Pleae help me to give logic and code for this program  Write a function that given the string ?original? create a new string ?dramatic? that has two...://www.roseindia.net/java/beginners/StringReverseUsingStringUtils.shtml
ATM Logic - Java Beginners
ATM Logic   Q-In an ATM program i want to print the receipt in which there is information of rupees note that come out from an ATM machine when user... rupee note and so on. PLEASE GIVE ME THE CODE FOR THIS. AshishChaudhary
logic - Java Beginners
.   Hi friend, Code to solve the problem : class StringLogic...+"\""); System.out.println(s+"."); } } For more information on Java visit to : http://www.roseindia.net/java/ Thanks
leap year logic - Java Beginners
leap year logic  hi frds.. can u give me logic for leap year..  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/Leapyear.shtml Thanks
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
LOGIC
LOGIC  hey guys..i have my exams coming in somedays and it would be really helpful if someone explained how to develop the logic of any program
deploy jsp using web logic - Java Beginners
deploy jsp using web logic  Hi all, I am new in Web logic server please tell me what is the steps of writing deployee the jsp using web logic. and steps also arrange the folder its urgent
Logic Building
Logic Building  I wanted to devlop my logic ? How can i do so ? Can i start with java or i need to do c++ before
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
JAVA code For
JAVA code For   JAVA code For "Traffic signals Identification for vehicles
Logic and Degin
Logic and Degin  Need help in writing a pseudocode for this can so... will modify the existing code to create a modularized design. Load the array via a .txt file. Prompt to see if the user wants to search for a zip code. Prompt
Logic Iterate.
Logic Iterate.  I have one doubt about logic:iterate. I use text feild inside of logic:iterate , there is possible will generate N no of rows (text feild) inside of iterate. my doubt is how to get the Paritcular rows text
Logic Iterate.
Logic Iterate.  logic iterate Struts I have one doubt about logic:iterate. I use text field inside of logic:iterate , there is possible... the Particular rows text value. for example: print("<logic:iterate id="xid
java code
java code  what is the code to turn off my pc through java program
JAVA CODE
JAVA CODE  JAVA SOURCE CODE TO BLOCK A PARTICULAR WEB SITES(SOCIAL WEB SITE
java code
java code  write a java code to convert hindi to english using arrays
java code
java code  hi any one please tell me the java code to access any link i mean which method of which class is used to open any link in java program
java code
java code  need java code for chart or graph which compare the performance of aprior algorithm and coherent rule algorithm.plz any one help me out
java code
java code  write a java code for finding a string in partiular position in a delimited text file and replace the word with the values given by user and write the file in new location
java code
java code  sir how to merge the cells in excel using java code please help me and also how to make the text placed in the cell to be center
java code
java code  sir how to merge the cells in excel using java code please help me and also how to make the text placed in the cell to be center
Logic and Design
Logic and Design  Please help me with this Write a program that prompts and accepts a number between 1 and 12. After getting the input, display...(num+"th month "+mn[num-1]; } }   //copy the previous code in notepad
logic-iterate
logic-iterate  in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me <%@ page import="java.sql.*" %> <%String[] id = (String[])session.getAttribute("ids
java code
java code  I need the java code that would output the following: HARDWARE ITEMS CODE DESCRIPTION UNIT PRICE K16 Wood screws,brass,20mm $7.75 D24 Wood glue,clear,1 liter $5.50 M93
Java code
Java code   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes
logic for pattern program
create this program in java without help whats the logic how can i understand that whoe's program code its make this type output...logic for pattern program  what's the logic for create pattern
java code
java code  develop a banking system in java
java code
java code  HOW TO PRINT 1 TO 100 WITHOUT USING CONDITIONAL,ANY LOOP AND ARRAY IN JAVA AND C.URGENT SIR PLZ  Hi, You can use following code: class MyClass { public static void main(String[] args) { int
java code
java code  how to extract html tags using java
Java code
Java code  Write a program which performs to raise a number to a power and returns the value. Provide a behavior to the program so as to accept any... the following code: import java.util.*; import java.text.*; class NumberProgram
java code
java code  int g() { System.out.println("Inside method g"); int h() { System.out.println("Inside method h"); } } Find the error in the following... cannot define a method inside another method. Anyways, we have modified your code
java code
java code  what is meaning bufferedreader
java code
java code  what is meaning bufferedreader
Java code
Java code   Create a calculator class which will have methods add, multiply, divide & subtract   Hi Friend, Try the following code: class Calculation{ public int add(int a,int b){ return a+b
Java code
Java code  An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus...; Hi Friend, Try the following code: import java.util.*; import
java code
java code  i want HSVcolor descriptor for color image in java coding
java code
java code  I am beginer in java my question is how can i fill data from mysql database to jcombobox using netbeans
Java Code
Java Code  Write a java program, which creates multiple threads. Each thread performs add/delete/update operations on an ArrayList simultaneously
java code
java code  hi, Can any one tell me " How to read the data which is present om an image in java
Java code
Java code  Create a class called Student which has the following methods: i. Average: which would accept marks of 3 examinations & return... & returns the name.   Hi Friend, Try the following code: import
Java code
Java code  Create a Bank class with methods deposit & withdraw. The deposit method would accept attributes amount & balance & returns....   Hi Friend, Try the following code: import javax.swing.*; class
Java code
Java code   Create an Employee class which has methods netSalary which would accept salary & tax as arguments & returns the netSalary which... the following code: import java.util.*; class Employee { static Scanner input=new
java code
java code  An employee _id consist of 5 digits is stored in a string variable strEmpid. Now Mr.Deb wants to store this Id in Integer type to IntEmpid. write Java statements to do
java code
java code  Write a program to find the difference between sum of the squares and the square of the sums of n numbers
java code
java code   Develop a program that accepts the area of a square and will calculate its perimeter
java code
java code  Create a calculator class which will have methods add, multiply, divide & subtract
Advertisements
 

 

 

DMCA.com