TercerParcial - System.out.print(1); else if(u==n)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*;  import java.util.*;  public class TercerParcial{    public static Scanner teclado = new Scanner(System.in);    public static void number1(int n){  for(int i=1; i<=n; i++){  for(int u=1; u<=n; u++){  if(u==i)  System.out.print(u);  else  System.out.print(0);}  System.out.println();      public static void number2(int n){  for(int i=1; i<=n; i++){  for(int u=1; u<=n; u++){  if(u%2==0)  System.out.print(1);  else  System.out.print(0);  System.out.println();    public static void number3(int n){  for(int i=1; i<=n; i++){  for(int u=1; u<=n; u++){  if(u==1) 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.print(1); else if(u==n) System.out.print(n); else System.out.print(0); } System.out.println(); } } public static void main(String args){ int n; String user = ""; do{ System.out.print("Ingrese el valor de n (positivo): "); n = teclado.nextInt(); number1(n); System.out.println(); System.out.println(); number2(n); System.out.println(); System.out.println(); number3(n); System.out.println("\n\nDesea continuar?"); user = teclado.next(); }while(user.toLowerCase().equals("si")); } }...
View Full Document

This note was uploaded on 10/29/2009 for the course ITC TC-1002 taught by Professor X during the Spring '09 term at ITESM.

Page1 / 2

TercerParcial - System.out.print(1); else if(u==n)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online