Home Answers Viewqa Java-Beginners java code and logic

 
 


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

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 Pages:
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
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
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
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
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
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 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
Struts logic iterate
Struts logic iterate  This is my jsp page in which i used 3 logic...; <%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>...; <body> <h1> Search </h1> <logic:iterate name
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
<logic:iterate> - Struts
is the jsp my PROBLEM IS IAM NOT GETTING THE LIST FROM THE LOGIC ITERATE ?? DID I DID ANYTHING WRONG IN THIS CODE BELOW... the code in my ques I want to use only struts tag not scriplet tag So pl help me
Logic error? HELP PLEASE! :(
Logic error? HELP PLEASE! :(  Hello Guys! i have a huge problem. What I want to do is there is a retrieve jsp page. In the retrieve jsp page...//DTD HTML 4.01 Transitional//EN"><%@page language="java" contentType="text
Not getting the logic - JSP-Servlet
; HELLO Frend Can you send me your code? Thanks
Integrating Business Logic Tier and Integration Tier Components
Integrating Business Logic Tier and Integration Tier Components...; In the business logic tier web have created business objects, business services...; Here is the full code of applicationContext-hibernate.xml file
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
Business Objects of Business Logic tier
Business Objects of Business Logic tier   ... will develop the objects of business logic tier. Business logic tier referrers... logic tier communicates both with user interface tier and the database tier
Separating UI from Logic
Java NotesSeparating UI from Logic One of the most important ideas... and controller, ...) from the logic (model, engine, ...). There are two really..., maintain, etc. A different user interface or logic model can be added
Separating UI from Logic
Java NotesSeparating UI from Logic One of the most important ideas... and controller, ...) from the logic (model, engine, ...). There are two really..., maintain, etc. A different user interface or logic model can be added
java bean code - EJB
java bean code  simple code for java beans  Hi Friend, Java Beans are reusable components. They are used to separate Business logic from.... Java Bean Code: public class EmployeeBean{ public int id; public
With reference to the question " TELL US THE LOGIC OF DICEROLLER"???
With reference to the question " TELL US THE LOGIC OF DICEROLLER"???  Tell us the logic of diceroller 1 Answer(s) 18 minutes and 38 seconds ago Posted in : Java Beginners As told ""The (Math.random()*6)+1 returns the random
code
code    how to write this in java
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
code
code  < comp xlink:type="new" xlink:actuate="onload"/> how to write this in java
Logic Present Tag (<logic:equal>...</logic:equal>)
..<logic:empty> and the <logic:notEmpty>). Example code Creating... Logic Present Tag (<logic:equal>...</logic:equal>) ... scope" if not specified.   Logic
Logic Empty Tag (<logic:empty>...</logic:empty>)
(ie..<logic:empty> and the <logic:notEmpty>). Example code Creating... Logic Empty Tag (<logic:empty>...</logic:empty>) ...; if not specified. Logic notEmpty Tag (<logic:notEmpty>
Logic greaterEqual Tag (<logic: greaterEqual>... </logic:greaterThan>)
; and the <logic:greaterThan>). Example code Creating an Action  Class... Logic greaterEqual Tag (<logic: greaterEqual>...</logic... attribute(s) of this tag, needed to compare Logic greaterThan Tag (<
Logic LessEqual Tag (<logic:lessEqual>...</logic:lessEqual>)
:lessEqual > and the <logic:LessThan >). Example code Creating... Logic LessEqual Tag (<logic:lessEqual>...</logic:lessEqual>..., needed to compare   Logic LessThan Tag (<logic:lessThan >
Logic Present Tag (<logic:present >...</logic:present >)
;logic:notPresent >). Example code Creating an Action  Class Develop... Logic Present Tag (<logic:present >...</logic:present >) ....   Logic notPresent Tag (<logic:not Present>...<
Logic Equal Tag (<logic:equal>...</logic:equal>)
..<logic:equal > and the <logic:notEqual >). Example code Creating... Logic Equal Tag (<logic:equal>...</logic:equal>) ..., needed to compare Logic notEqual Tag
Code
Code  how to print this?? with the use of only JSP....... 1 23 456 78910   Here is the jsp number pattern example: 1 2 3 4 5 6 7 8 9 10 <%@page language="java"%> <% int k = 1; for(int i=1; i<= 4 ;i
Logic Match Tag (<logic:match >...</logic:match >)
; and the <logic:notMatch>). Example code Creating an Action  Class... Logic Match Tag (<logic:match >...</logic:match >) ....   Logic notMatch  Tag (<logic:notMatch  >
Logic and desgin
Logic and desgin  How would this be put in visual logic symbol
Multiple Methods in Jsp
;This tag is known as  Scriplets . We can embed any amount of java code...;    Jsp is used mainly for presentation logic. In the jsp we can declare methods just like as we declare methods in java classes
making a web application using Web-Logic Server - Struts
making a web application using Web-Logic Server  Hello , I am a beginner to the java platform so i am facing some problem in making a web aplication using a struts framework.Hence i referred the docs given in the link http
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
jdbc connection to java program code - JDBC
jdbc connection to java program code  i want a simple java program that which communicates with oracle database like creating table,insert values... table structure as an example so that i am able to understand logic
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
How to handle the list dynamically in struts inside logic:iterate tag
How to handle the list dynamically in struts inside logic:iterate tag  I am having following code in JSP <table> <tr> <logic...;/td> </tr> </logic:iterate> <td> </td> </tr>
JAVA code For
JAVA code For   JAVA code For "Traffic signals Identification for vehicles
Program to find no of metrics in a file ----- Java code
Program to find no of metrics in a file ----- Java code  Hi Friends... the tablewise no of SELECT and INSERT statements, I have written the code for finding... me the logic how to calculate the statements tablewise, it will be a great help
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  develop a banking system in java
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.