Typecasting
Thu Dec 21 2023 15:51:08 GMT+0000 (Coordinated Universal Time)
Saved by
@user01
import java.util.*;
class typecasting{
int a,b,c,total;
double avg;
void input(){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the marks:");
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
}
void calc(){
total = a+b+c;
avg = total/3.0;
System.out.println(total);
System.out.println(avg);
int avg = (int)total/3;
System.out.println(avg);
}
}
class typecasting1{
public static void main(String[]args){
typecasting t1 = new typecasting();
t1.input();
t1.calc();
}
}
content_copyCOPY
Comments