User:Varavour/Work

CW16

/*   Note: insert KeyboardReader elements

public class triangle {       public static void main(String[] args) {   //  KeyboardReader reader =new KeyboardReader; int row1,b,c,d,e,f,g,h; row1=7; for(b=0;b=b;c--) {               System.out.print("*"); }           System.out.println(""); }       for(b=0;bb;c--) {               System.out.print("*"); }           System.out.println(""); }   } }

CW18

public class xysum {   public static void main(String[] args) {       int sum,total,a,b,x,y,i,j,im,jm; sum=146; total=0; x=0; y=0; for(im=1;im<=100;im++) {      	 for(x=1;x<=100;x++) {        		for(y=1;y<=100;y++) {        			if(x+y==sum) {     	 				System.out.println(x+"="+y+"="+sum); total=total+1; }	      			}       		}      }      System.out.println("The total amount of pairs equaling the sum of 146 is "+total); } }