public class HelloWorld
{
public static void main(String[] args)
{
String loImooc ="我爱幕课网";
String loImooc1="www.imoooc.com";
System.out.println(loImooc);
System.out.println(loImooc1);
}
}
{
public static void main(String[] args)
{
String loImooc ="我爱幕课网";
String loImooc1="www.imoooc.com";
System.out.println(loImooc);
System.out.println(loImooc1);
}
}
2015-06-15
这是等腰三角形,n为层数。字数太多放不下,我就不空行了
int n = 6;
int m = (1+n)*n/2-1;
for (int i = 1; i <= n ; i++ ){
for (int j =1; j<=m ;j++ ){
if ((j > m/2+1-i ) && (j <=m/2+i )) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
int n = 6;
int m = (1+n)*n/2-1;
for (int i = 1; i <= n ; i++ ){
for (int j =1; j<=m ;j++ ){
if ((j > m/2+1-i ) && (j <=m/2+i )) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
2015-06-14
这样三的倍数也可以
public class practise {
public static void main(String[] args) {
int sum = 0;
int num = 2;
do {
if (num % 2 == 0){
sum+=num;
}
num++;
} while ( num<=50 );
System.out.println(" 50以内的偶数之和为:" + sum );
}
}
public class practise {
public static void main(String[] args) {
int sum = 0;
int num = 2;
do {
if (num % 2 == 0){
sum+=num;
}
num++;
} while ( num<=50 );
System.out.println(" 50以内的偶数之和为:" + sum );
}
}
2015-06-14
帮助大家理解异或:设FLASE=0;TURE=1.
0^0==>0
1^1==>0
0^1==>1
1^0==>1
0^0==>0
1^1==>0
0^1==>1
1^0==>1
2015-06-14