by聽CodeChum Admin
My friends are geeking out with this new device I invented. It checks if a number is even or odd! 馃く聽
Do you want to try it out?
Instructions:
Input
1. Integer n
2. N integer values
Answers the question below:
1. What do you call the 1st array/index in two dimensional array?
2. What do you call the 2nd array/index in two dimensional array?
3. What is the output of the given code?
double[] sales = {12.5, 32.50, 16.90, 23, 45.68,
9, 10.5};
for(int i=0; i<sales.length; i++)
{ } System.out.print(sales.length);
4. What is the output of the given code?
double[][] sales = {
{12.5, 32.50}, (16.90, 23, 45.68}, {1, 2, 3, 4},
};
System.out.print(sales[2][1]);
5. What is the output of the given code?
double[][] sales = {
(12.5, 32.50), (16.90, 23, 45.68}, {1, 2, 3, 4),
}; System.out.print(sales[1][1]);
by聽CodeChum Admin
We've been giving positive numbers too much attention lately, it's time to let negative numbers take the spotlight this time!
Instructions:
Input
1. First decimal number
2. Second decimal number
3. Third decimal number
4. Fourth decimal number
Output
The first four lines will contain message prompts to input the four decimal numbers.
The last line contains the sum of all the inputted negative numbers, with 2 decimal places.
Enter路the路first路number:路-30.22
Enter路the路second路number:路10.5
Enter路the路third路number:路-2.2
Enter路the路fourth路number:路-1.8
Sum路of路all路negatives路=路-34.22
by聽CodeChum Admin
This one is a bit tricky. You're going to have to isolate each digit of the integer to determine which one is the largest, so good luck!
Instructions:
Input
1. A three-digit integer
Output
The first line will contain a message prompt to input the 3-digit integer.
The last line contains the largest digit of the inputted integer.
Enter路a路3-digit路integer:路173
Largest路=路7
by聽CodeChum Admin
This one is a bit tricky. You're going to have to isolate each digit of the integer to determine which one is the largest, so good luck!
Instructions:
Input
1. A three-digit integer
Output
The first line will contain a message prompt to input the 3-digit integer.
The last line contains the largest digit of the inputted integer.
Enter路a路3-digit路integer:路173
Largest路=路7
by聽CodeChum Admin
We've been dealing with integers too much, it's time for float to shine!
Instructions:
Input
1. First float number
2. Second float number
3. Third float number
4. Fourth float number
5. Fifth float number
Output
The first five lines will contain message prompts to input the five float numbers.
The next line contains the inputted float numbers.
The last line contains "Yes" if the condition is true.
Enter路the路first路number:路1.1
Enter路the路second路number:路1.2
Enter路the路third路number:路1.3
Enter路the路fourth路number:路1.4
Enter路the路fifth路number:路1.1
1.1路1.2路1.3路1.4路1.1
Yes
. Are Integers Created Equally?
by CodeChum Admin
It's time to find out if something is true or false. Let's test your capabilities by creating a program that checks if two integers are equal!
Instructions:
Input two integers in one line.
Print the two integers in one line, and separate them with a space.
Print a string message "Equal" on a new line, if both inputted integers are equal.
Input
1. First integer
2. Second integer
Output
The first two lines will contain message prompts to input the two integers.
The next line will contain the inputted integers.
The last line will contain a string which is the result, if the condition were true.
Enter路the路first路integer:路5
Enter路the路second路integer:路5
5路5
Equal
Input the gender of 10 students in the form of m, M or f, F. Display how many students are male and female. Use for loop and while loop.
Convert a ten digit number to a string following the rules
Andy has the word W and he wants to print the unique characters in the word in the order of their occurrence.write a program to help Andy print the unique characters as described above.
NOTE : consider lower and upper case letters as different
Input
The input is a single line containing the word W.
Output
The output should be a single line containing space separated characters.
Explanation
In the example, the word is MATHEMATICS
The unique characters in the given word are M, A, T, H, E, I, C, S, in the order of occurrence.so the output should be M A T H E I C S.
Sample Input1
MATHEMATICS
Sample Output1
M A T H E I C S
Sample Input2
banana
Sample Output2
b a n