Preview:
 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();
	 }
 } 
	 
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter