Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pkg2powern;
/**
*
Ebtsam FATHY
*/
import java.util.Scanner;

public class Main {

/**
* @param args the command line arguments
*/


public static void main(String[] args) {

int N,pow;
int Result=1;
Scanner sc=new Scanner(System.in);
System.out.println("enter the number");
N=sc.nextInt();
System.out.println("enter the power");
pow=sc.nextInt();
if(N>=0&&pow==0){
Result=1;
}
if(N==0&&pow>=1){
Result=0;
}
else{
int i=1;
while(i<=pow){
Result=Result*N;
i++;
}
}
System.out.println( N+"^"+pow+"="+Result);

}
}


11 changes: 11 additions & 0 deletions src/CircleCircumference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

public class CircleCircumference implements ISubscriber {

@Override
public void notifySubscriber(String input) {
// TODO Auto-generated method stub
double r=Double.parseDouble(input);
System.out.println("circle circumference = "+(2*3.14*r));
}

}
17 changes: 17 additions & 0 deletions src/LucasSeries.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class LucasSeries implements ISubscriber {
public static int lucas_series(int number) {
if (number == 0)
return 2;
if (number == 1)
return 1;
return lucas_series(number - 1) + lucas_series(number - 2);
}

@Override
public void notifySubscriber(String input) {
int Lenght = Integer.parseInt(input);
System.out.println("Hello, I am really a simple Lucas series and I am notified with " + input);
System.out.println("LUcas Number Is : "+lucas_series(Lenght));
}

}
17 changes: 0 additions & 17 deletions src/Main.java

This file was deleted.

8 changes: 8 additions & 0 deletions src/SphereCircumference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

public class SphereCircumference implements ISubscriber {

public void notifySubscriber(String input) {
double R = Double.parseDouble(input);
System.out.println("Sphere Circumference is = " + (2*3.14*R));
}
}