Enter 3 numbers from the user & make a function to print their average. To find the average of three numbers, you need to add the three numbers together and then divide the sum by three. Here's how you can write a function in C++, C, Python, and Java to take three numbers from the user and calculate their average: JAVA import java . util .*; public class Solutions { public static void main ( String args []) { Scanner sc = new Scanner ( System . in ); int a = sc . nextInt (); int b = sc . nextInt (); int c = sc . nextInt (); int average = ( a + b + c ) / 3 ; System . out . println ( average ); } } C++: // c++ #include <iostream> using namespace std ;...
A student of engineering and I am interested in coding specially in java. I have been working on this blog for the past few months and I have learned a lot about java and now I will try to help you to crack placement's. The blog will cover different types of java coding programs, their features, benefits, and why they are important. we have the best java placements solutions also.
Comments
Post a Comment