Given X is an N-digit odd positive integer such that X is divisible by 3 but not by 9. NOTE: There should not be any leading zeros in X. 003 is not a valid three-digit even integer. Input Format: The first line of input contains a single integer T, denoting the number of test cases. The first and only line of each test case contains a single integer N, denoting the numbe of digits in X.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
icon
Related questions
icon
Concept explainers
Question
Note: A input file named "input.txt" is attached with this test. Read the file as input and
save the output in the required format in a separate file named “output.txt".
Given X is an N-digit odd positive integer such that X is divisible by 3 but not by 9.
NOTE: There should not be any leading zeros in X. 003 is not a valid three-digit even integer.
Input Format:
• The first line of input contains a single integer T, denoting the number of test cases.
• The first and only line of each test case contains a single integer N, denoting the numbe
of digits in X.
Output Format:
For each test case, output a single line containing N-digit even positive integer X, such
that X is divisible by 3 but not by 9.
Constraints:
1STS100
1SNS50
Sample Input
Sample Output
3
15
2
1
105
3
Transcribed Image Text:Note: A input file named "input.txt" is attached with this test. Read the file as input and save the output in the required format in a separate file named “output.txt". Given X is an N-digit odd positive integer such that X is divisible by 3 but not by 9. NOTE: There should not be any leading zeros in X. 003 is not a valid three-digit even integer. Input Format: • The first line of input contains a single integer T, denoting the number of test cases. • The first and only line of each test case contains a single integer N, denoting the numbe of digits in X. Output Format: For each test case, output a single line containing N-digit even positive integer X, such that X is divisible by 3 but not by 9. Constraints: 1STS100 1SNS50 Sample Input Sample Output 3 15 2 1 105 3
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning