Java Programming

  1. Java Program: to Calculate Average of 3 Numbers
    public class Average {
      public static void main(String[] args) {
    
        // take two numbers
        double num1 = 30;
        double num2 = 30;
        double num3 = 30;
    
        // declare sum variable
        // and initialize with 0
        double sum = 0.0;
        // declare average variable
        double avg = 0.0;
    
        // calculate the sum value
        sum = num1 + num2 + num3;
        // calculate the average value
        avg = sum/3;
    
        // display result
        System.out.println("Average: " + avg );
      }
     }
    
    
  2. Output:
    
    Average: 30.0
                  

Others Programming Language

article

programming C

Muktarul Hossain
article

C++

Muktarul Hossain
article

Python

Muktarul Hossain
article

Website Design

Muktarul Hossain