SlideShare une entreprise Scribd logo
1  sur  2
Write the definition of the function named timesTable which has no parameters and returns
nothing. This function displays the times table chart as following
: 001 002 003 004 005 006 007 008 009 010 011 012 002 004 006 008 010 012 014 016 018 020
022 024 003 006 009 012 015 018 021 024 027 030 033 036 004 008 012 016 020 024 028 032
036 040 044 048 005 010 015 020 025 030 035 040 045 050 055 060 006 012 018 024 030 036
042 048 054 060 066 072 007 014 021 028 035 042 049 056 063 070 077 084 008 016 024 032
040 048 056 064 072 080 088 096 009 018 027 036 045 054 063 072 081 090 099 108 010 020
030 040 050 060 070 080 090 100 110 120 011 022 033 044 055 066 077 088 099 110 121 132
012 024 036 048 060 072 084 096 108 120 132 144
Solution
TimeTable.java
public class TimeTable {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
timesTable();
}
public static void timesTable (){
for(int i=1; i<=12; i++){
for(int j=1; j<=12; j++){
System.out.print(String.format("%03d", (i * j)) + " ");
}
}
}
}
Output:
001 002 003 004 005 006 007 008 009 010 011 012 002 004 006 008 010 012 014 016 018 020
022 024 003 006 009 012 015 018 021 024 027 030 033 036 004 008 012 016 020 024 028 032
036 040 044 048 005 010 015 020 025 030 035 040 045 050 055 060 006 012 018 024 030 036
042 048 054 060 066 072 007 014 021 028 035 042 049 056 063 070 077 084 008 016 024 032
040 048 056 064 072 080 088 096 009 018 027 036 045 054 063 072 081 090 099 108 010 020
030 040 050 060 070 080 090 100 110 120 011 022 033 044 055 066 077 088 099 110 121 132
012 024 036 048 060 072 084 096 108 120 132 144

Contenu connexe

Plus de karlynwih

Write an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxWrite an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxkarlynwih
 
You and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxYou and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxkarlynwih
 
Write an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxWrite an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxkarlynwih
 
Write an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxWrite an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxkarlynwih
 
write a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxwrite a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxkarlynwih
 
Write up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxWrite up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxkarlynwih
 
Write an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docxWrite an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docxkarlynwih
 
Write the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxWrite the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxkarlynwih
 
Write the formal description of the following state machine (M) What.docx
Write the formal description of the following state machine (M)  What.docxWrite the formal description of the following state machine (M)  What.docx
Write the formal description of the following state machine (M) What.docxkarlynwih
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxkarlynwih
 
Write the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxWrite the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxkarlynwih
 
Write functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxWrite functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxkarlynwih
 
Write about the two sources of energy Write about the two sources of.docx
Write about the two sources of energy   Write about the two sources of.docxWrite about the two sources of energy   Write about the two sources of.docx
Write about the two sources of energy Write about the two sources of.docxkarlynwih
 

Plus de karlynwih (13)

Write an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docxWrite an SML function groupdupes that takes a list of integers as its.docx
Write an SML function groupdupes that takes a list of integers as its.docx
 
You and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docxYou and another tech are discussing the relative merits of SCSI interf.docx
You and another tech are discussing the relative merits of SCSI interf.docx
 
Write an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docxWrite an application class (ArrayListApplication) that contains a main.docx
Write an application class (ArrayListApplication) that contains a main.docx
 
Write an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docxWrite an algorithm for a program that shows the use of all six math fu.docx
Write an algorithm for a program that shows the use of all six math fu.docx
 
write a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docxwrite a topic about RFID in SCM and what you have learned about adopti.docx
write a topic about RFID in SCM and what you have learned about adopti.docx
 
Write up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docxWrite up a simple c-program to find the median of any array-Solution#i.docx
Write up a simple c-program to find the median of any array-Solution#i.docx
 
Write an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docxWrite an assembly language program in the Pep-8 simulator that corresp.docx
Write an assembly language program in the Pep-8 simulator that corresp.docx
 
Write the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docxWrite the for structure in JAVA coding to read and display all element.docx
Write the for structure in JAVA coding to read and display all element.docx
 
Write the formal description of the following state machine (M) What.docx
Write the formal description of the following state machine (M)  What.docxWrite the formal description of the following state machine (M)  What.docx
Write the formal description of the following state machine (M) What.docx
 
Write the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docxWrite the C++ code for a function getInput which will read in an unkno.docx
Write the C++ code for a function getInput which will read in an unkno.docx
 
Write the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docxWrite the balanced reaction where thiosulfate and protons are the only.docx
Write the balanced reaction where thiosulfate and protons are the only.docx
 
Write functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docxWrite functions odd and even- which takes a list of symbols L- and pro.docx
Write functions odd and even- which takes a list of symbols L- and pro.docx
 
Write about the two sources of energy Write about the two sources of.docx
Write about the two sources of energy   Write about the two sources of.docxWrite about the two sources of energy   Write about the two sources of.docx
Write about the two sources of energy Write about the two sources of.docx
 

Write the definition of the function named timesTable which has no par.docx

  • 1. Write the definition of the function named timesTable which has no parameters and returns nothing. This function displays the times table chart as following : 001 002 003 004 005 006 007 008 009 010 011 012 002 004 006 008 010 012 014 016 018 020 022 024 003 006 009 012 015 018 021 024 027 030 033 036 004 008 012 016 020 024 028 032 036 040 044 048 005 010 015 020 025 030 035 040 045 050 055 060 006 012 018 024 030 036 042 048 054 060 066 072 007 014 021 028 035 042 049 056 063 070 077 084 008 016 024 032 040 048 056 064 072 080 088 096 009 018 027 036 045 054 063 072 081 090 099 108 010 020 030 040 050 060 070 080 090 100 110 120 011 022 033 044 055 066 077 088 099 110 121 132 012 024 036 048 060 072 084 096 108 120 132 144 Solution TimeTable.java public class TimeTable { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub timesTable(); } public static void timesTable (){ for(int i=1; i<=12; i++){ for(int j=1; j<=12; j++){ System.out.print(String.format("%03d", (i * j)) + " "); } } } } Output:
  • 2. 001 002 003 004 005 006 007 008 009 010 011 012 002 004 006 008 010 012 014 016 018 020 022 024 003 006 009 012 015 018 021 024 027 030 033 036 004 008 012 016 020 024 028 032 036 040 044 048 005 010 015 020 025 030 035 040 045 050 055 060 006 012 018 024 030 036 042 048 054 060 066 072 007 014 021 028 035 042 049 056 063 070 077 084 008 016 024 032 040 048 056 064 072 080 088 096 009 018 027 036 045 054 063 072 081 090 099 108 010 020 030 040 050 060 070 080 090 100 110 120 011 022 033 044 055 066 077 088 099 110 121 132 012 024 036 048 060 072 084 096 108 120 132 144