0% found this document useful (0 votes)
472 views1 page

Apna College Answers of Questions

This Java code defines a class P1 with a static method Average that calculates the average of three integer parameters passed to it. The main method prompts the user to input three integers, calls the Average method to calculate their average, and prints the result.

Uploaded by

A Karthik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
472 views1 page

Apna College Answers of Questions

This Java code defines a class P1 with a static method Average that calculates the average of three integer parameters passed to it. The main method prompts the user to input three integers, calls the Average method to calculate their average, and prints the result.

Uploaded by

A Karthik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

K.java k1.java lest.java P1.

java Firstjava
1 package practice;
2 import java.util.*;
3 public class P1 {
public static int Average(int n1,int n2,int n3)
int avg=(n1+n2+n3)/3;
return avg
S

18
11 public static void main (String[] args) {
12 Scanner sc =new Scanner(System.in);
13 int n1 =sc.nextInt()
14 int n2 =sc.nextInt():
15 int n3 =sc.nextInt()
16 int avg=Average (n1, n2, n3);
System.out.println(avg)
18
19

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy