package a; public class A { public void add(int m)
{
int sum=0;
for (int i = 1; i <=m; i++)
{
sum+=i; }
System.out.println("1+2+…+"+m+"="+sum);
} }
package b; public class B {
public void cheng(int n)
{
int ji=1;
for (int i = 1; i <=n; i++) {
ji*=i; }
System.out.println(n+"!="+ji);
} }
package C;
import a.A;
import b.B;
public class C { public static void main(String[] args) {
A a=new A();
a.add(30);
B b=new B();
b.cheng(5); } }