This is a small blog for programming.I want to share my thinking,creation and learning to all of you.I also want to develop my own skill as well as yours.
Monday, October 20, 2014
Sunday, October 19, 2014
Friday, October 17, 2014
Random Number generator In Java
Program:
package prem4;
import java.util.Random;
public class koresi4 {
public static void main(String[]args){
Random trace=new Random ();
int counter;
int number;
for(counter=0;counter<10;counter++){
number=trace.nextInt(8);
System.out.println(number+"");
}
}
}
package prem4;
import java.util.Random;
public class koresi4 {
public static void main(String[]args){
Random trace=new Random ();
int counter;
int number;
for(counter=0;counter<10;counter++){
number=trace.nextInt(8);
System.out.println(number+"");
}
}
}
Output:
2
4
2
3
7
6
3
1
0
3
Screenshots
Program
Output
Mathematical Methods In Java
Program:
package prem3;
public class koresi3 {
public static void main(String[] args){
System.out.println(Math.abs(-3.8)); //absolute value will be the output
System.out.println(Math.pow(3.3, 2));//here 3.3^2=10.88999999999
System.out.println(Math.max(294, 654));//here the maximum value will be the output
System.out.println(Math.min(856, 121));//here the minimum value is 121
System.out.println(Math.ceil(9.8));//here 9.8 will be 10
System.out.println(Math.ceil(13.4));//here 13.4 will be 14
System.out.println(Math.floor(45.6));//here 45.6 will be 45
System.out.println(Math.sqrt(225));//sqrt means sqare route so output 15
}
}
package prem3;
public class koresi3 {
public static void main(String[] args){
System.out.println(Math.abs(-3.8)); //absolute value will be the output
System.out.println(Math.pow(3.3, 2));//here 3.3^2=10.88999999999
System.out.println(Math.max(294, 654));//here the maximum value will be the output
System.out.println(Math.min(856, 121));//here the minimum value is 121
System.out.println(Math.ceil(9.8));//here 9.8 will be 10
System.out.println(Math.ceil(13.4));//here 13.4 will be 14
System.out.println(Math.floor(45.6));//here 45.6 will be 45
System.out.println(Math.sqrt(225));//sqrt means sqare route so output 15
}
}
Output:
3.8
10.889999999999999
654
121
10.0
14.0
45.0
15.0
Screenshots
Program
Output
Thursday, October 16, 2014
Software: Find Interest Using Formula In Java
Software: Find Interest Using Formula In Java: Program: //formula:A=p*(1+r)^n package perm; public class koresi { public static void main(String[]args){ double real=1000; d...
Wednesday, October 15, 2014
Find Interest Using Formula In Java
Program:
//formula:A=p*(1+r)^n
package perm;
public class koresi {
public static void main(String[]args){
double real=1000;
double rate=0.01;
double result;
int day;
for(day=1;day<=20;day++){
result=real*Math.pow(1+rate, day);
System.out.println(day+" "+result);
}
}
}
//formula:A=p*(1+r)^n
package perm;
public class koresi {
public static void main(String[]args){
double real=1000;
double rate=0.01;
double result;
int day;
for(day=1;day<=20;day++){
result=real*Math.pow(1+rate, day);
System.out.println(day+" "+result);
}
}
}
Output:
1 1010.0
2 1020.1
3 1030.3010000000002
4 1040.60401
5 1051.0100501000002
6 1061.520150601
7 1072.13535210701
8 1082.8567056280801
9 1093.6852726843608
10 1104.6221254112045
11 1115.6683466653164
12 1126.8250301319697
13 1138.0932804332895
14 1149.4742132376225
15 1160.9689553699986
16 1172.5786449236987
17 1184.3044313729356
18 1196.147475686665
19 1208.1089504435315
20 1220.190039947967
Program
Output
Subscribe to:
Posts (Atom)