class area { public static void main(String args[]) { int area, length, breadth; length=10; breadth=29; area=breadth* length; System.out.println(area); }}
Q- What is Smart art? Ans- A SmartArt graphic is a visual representation of your information and ideas. Q- How to insert smart art. Ans- Click the insert tab-> click the smart art-> chose one smart art-> ok
Q- What is word art? Ans- Special effects in Microsoft Word that change the appearance of text. Q- How to insert Word art Ans- click insert tab-> word art-> choose one design-> write your text -> ok
Q. What is header and footer? A header is the top margin of each page, and a footer is the bottom margin of each page. Headers and footers are useful for including material that you want to appear on every page of a document such as your name, the title of the document, or page numbers. Q- How to insert Header and Footer Ans- click insert tab-> header or footer-> then insert
Select the text or object you want to use as a hyperlink . Right-click and then click Hyperlink . Under Link to, click Place in This Document. In the list, select the heading or bookmark that you want to link to or select the text ->click inset tab-> click hyperlink-> one window will open-> then chose the file -> ok
// change font color Select the text that you want to change . · On the Home tab, in the Font group, choose the arrow next to Font Color , and then select a color . // change font size Select the text that you want to change . · On the Home tab, in the Font group, choose the arrow next to Font Size , and then select a size .
open ms-word ->save option ->(one window will open)->write the file name ->save To use the Save As/save command: Click the Microsoft Office button . Select Save As/save Word Document . The Save As dialog box appears. Select the location where you want to save the document using the drop-down menu. Enter a name for the document. Click the Save button.
1 0 1 1 0 1 0 1 0 1 class series { public static void main(String args[]) { for(int r=1;r<=4;r++) { for (int c=1 ; c<=r ; c++) { if((r+c)%2==0) System.out.print(1+ " "); else System.out.print(0+" "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int d=1; // how many element in first line for(int r=1;r<=4;r++) { for (int c=1 ; c<=d ; c++) { if((r+c)%2==0) System.out.print(1+ " "); else System.out.print(0+" "); } d++; System.out.println() // to come to next line } } }
1 1 0 1 0 1 1 0 1 0 class series { public static void main(String args[]) { for(int r=1;r<=4;r++) { for (int c=1 ; c<=r ; c++) { if(c%2==0) System.out.print(0+ " "); else System.out.print(1+" "); } System.out.println() // to come to next line } } } //Common way class series { public static void main(String args[]) { int d=1; // how many element in first line for(int r=1;r<=4;r++) { for (int c=1 ; c<=d ; c++) { if(c%2==0) System.out.print(0+ " "); else System.out.print(1+" "); } d++; System.out.println() // to come to next line } } }
* * * * * * * * * * class series { public static void main(String args[]) { for(int r=1;r<=4;r++) { for (int c=1 ; c<=r ; c++) { System.out.print("*"+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int d=1; // d- means how many element in first line for(int r=1;r<=4;r++) { for (int c=1 ; c<=d ; c++) { System.out.print('*'+ " "); } d++; System.out.println() // to come to next line } } }
1 2 3 4 5 6 class series { public static void main(String args[]) { int a=1; for(int r=1 ; r<=3 ; r++) { for (int c=1 ; c<=r ; c++) { System.out.print(a+ " "); a++; } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=1, d=1; // a- means first value d- means how many element in first line for(int r=1;r<=4;r++) { for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); a++; } d++; System.out.println() // to come to next line } } }
1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 class series { public static void main(String args[]) { for(int r=5 ; r>=1 ; r--) { for (int c=r ; c<=5 ; c++) { System.out.print(c+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=1, d=5; // a- means first value d- means how many element in first line for(int r=1;r<=4;r++) { a=r; for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); a++; } d--; System.out.println() // to come to next line } } }
1 1 1 1 2 2 2 2 3 3 3 3 class series { public static void main(String args[]) { for(int r=1;r<=3;r++) { for (int c=1 ; c<=4 ; c++) { System.out.print(r+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=1, d=4; // a- means first value d- means how many element in first line for(int r=1;r<=3;r++) { for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); } a++; System.out.println() // to come to next line } } }
1 2 3 4 1 2 3 4 1 2 3 4 class series { public static void main(String args[]) { for(int r=1;r<=3;r++) { for (int c=1 ; c<=4 ; c++) { System.out.print(c+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=1, d=4; // a- means first value d- means how many element in first line for(int r=1;r<=4;r++) { a=1; for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); a++; } System.out.println() // to come to next line } } }
5 4 3 2 1 5 4 3 2 5 4 3 5 4 5 // shortcut way class series { public static void main(String args[]) { for(int r=1;r<=5;r++) // r- for row { for (int c=5 ; c>=r ; c--)// c- column { System.out.print(c+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=5, d=5; // a- means first value d- means how many element in first line for(int r=1;r<=5;r++) { a=5; for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); a--; } d--; System.out.println() // to come to next line } } }
1 1 2 1 2 3 1 2 3 4 //short cut way class series { public static void main(String args[]) { for(int r=1;r<=4;r++) { for (int c=1 ; c<=r ; c++) { System.out.print(c+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=1, d=1; // a- means first value d- means how many element in first line for(int r=1;r<=4;r++) { a=1; for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); a++; } d++; System.out.println() // to come to next line } } }
1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 class series { public static void main(String args[]) { for(int r=5 ; r>=1 ; r--) { for (int c=1 ; c<=r ; c++) { System.out.print(c+ " "); } System.out.println() // to come to next line } } } // common way class series { public static void main(String args[]) { int a=1, d=5; // a- means first value d- means how many element in first line for(int r=1;r<=4;r++) { a=1; for (int c=1 ; c<=d ; c++) { System.out.print(a+ " "); a++; } d++; System.out.println() // to come to next line } } }
// a number is said to binary if all the digit should be either zero or one ex-1011 binary number ex-1201 not binary number class binary { public static void main(String args[]) { int no=125,b=0,e=0; while(no>0) { b=n0%10; no=no/10; if(b>1) { e=1; break; } } if(e==0) System.out.println("the number is binary"); else System.out.println("the number is not binary"); } }
// if a number is present at the end of its square ex- 25 sqr=625 (25 is present at the end of 625) class automerphic { public static void main(String args[]) { int no=125, sqr=0,b=0,c=0,e=0; sqr=no* no; while(no>0 && sqr>0) { b=n0%10; no=no/10; c=sqr%10; sqr=sqr/10; if( b !=c) { e=1; // e is the marking symbol break; }} if(e==0) System.out.println("automerphic"); else System.out.println("not auto merphic"); } }
// if the addition of cube of all the digit of a number is same as original number ex- 153 1^3+5^3+3^3=153 class amstrong { public static void main(String args[]) { int no=125, sum=0,copy=0,b=0; while(no>0) { b=n0%10; no=no/10; sum=sum+b * b * b; } if(copy= =sum) System.out.println("amstrong number"); else System.out.println("not amstrong"); } }
// if the reverse of a number is same as original number then the number is palindrome // ex- a=121 ans -121 a=125 ans -521 is not palindrome class palindrome { public static void main(String args[]) { int no=125, rev=0,b=0 copy=no; while(no>0) { b=n0%10; no=no/10; rev=rev *10+b; } if(copy==rev) System.out.println("palindrome"); else System.out.println("not palindrome"); } }
// factorial of a number 5!= 5*4*3*2*1 =120 class factorial { public static void main(String args[]) { int no=10,fact=1; for(int i=1; i<=no ; i++) { fact=fact*i; } System.out.println(fact); }}
//if the addition of factors of a number except that number is same as original number then the number is perfect ex n0=6 factor 1,2,3 that means 1+2+3=6 then it is perfect number class perfect { public static void main(String args[]) { int no=10,sum=0; for(int i=1; i<no ; i++) { if(no%i==0) // i is the factor of that number { sum=sum+i } } if(sum==no) System.out.println("perfect number"); else System.out.println("not"); }}
class prime { public static void main(String args[]) { int no=10,count=0; for(int i=1; i<=no ; i++) { if(no%i==0) // i is the factor of that number { count++; } } if(count==2) System.out.println("prime no"); else System.out.println("composite no"); }}