This java program is able to calculate result in decimal value,
you only have to change 8 line of previous program from(double A,B,C,D,total;) to ( Float A,B,C,D,total;).
In this program we take four input number from user -A, B, C, D.
hear A, B, C are added and divided by D,this is the hole detail of program.
source code
In this program we take four input number from user -A, B, C, D.
hear A, B, C are added and divided by D,this is the hole detail of program.
source code
- import java.io.*;
- class sum_of_three_no_divide_by_fourth_no
- {
- public static void main(String[] args)throws IOException
- {
- InputStreamReader ir=new InputStreamReader(System.in);
- BufferedReader br=new BufferedReader(ir);
- Float A,B,C,D,total;
- System.out.println("Eter no1");
- A=Float.parseFloat(br.readLine());
- System.out.println("Eter no2");
- B=Float.parseFloat(br.readLine());
- System.out.println("Eter no3");
- C=Float.parseFloat(br.readLine());
- System.out.println("Eter no4");
- D=Float.parseFloat(br.readLine());
- total=(A+B+C)/D;
- System.out.println("Total="+total);
- }
- }
No comments:
Post a Comment