-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractisejava.java
More file actions
35 lines (32 loc) · 948 Bytes
/
Copy pathpractisejava.java
File metadata and controls
35 lines (32 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.*;
public class practisejava
{
public static void main(String[] args)
{
int p,n;
Scanner s= new Scanner(System.in);
System.out.println("enter the number:");
n=s.nextInt();
System.out.println("enter the power:");
p=s.nextInt();
s.close();
double r=Math.pow(n,p);
System.out.println("the result is:"+r);
/* int n;
float sum=0;
float average;
Scanner s= new Scanner(System.in);
System.out.println("enter the total number of elements :");
n=s.nextInt();
int a[]= new int[n];
System.out.println("enter the elements:");
for(int i=0;i<n;i++)
{
a[i]=s.nextInt();
sum=sum+a[i];
}
System.out.println("Sum is "+sum);
average=sum/n;
System.out.println("Average is"+average); */
}
}