10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
A company is planning to bucketize
its data to improve the search
operation. The data is a sequence of
digits [0-9]. The bucket ID is
calculated as the sum of all the prime
digits in the data. The prime number
is a number that is divisible only by
itself and 1.
Write an algorithm to find the bucket
ID for the data as the sum of all
prime digits in the data.
A company is offering a special discount to its customers based on an algorithm two range values are fed to the algorithm and in return it will calculate the discount to offer to the customers the discount is calculated as the sum of all.the prime numbers
String Concatenation
string concatenation program contains first line of input contains the string a, second line of input contains the string b, third line of input contains the string c and fourth line of input contains the string t
for example, we have a=mari , b=to, c=zzo, and t=1321.
concatenate these in the order a+c+b+a and print the resulting string: marizzotomari as the output.
Write a program to enter the numbers till the user enter ZERO '0' and at the end it should display the sum of numbers entered.
bulb states pattern
bulb states pattern program contain input is a single line containing a positive integer n representing the number of rooms in the building and the output should contain n lines , each line containing the state of the bulb in the room numbered from 1 to n in the form of 0 and 1.
example:
input: 5
Write a program to take a String as input then display the words in one column, its length in another column, replace the first with last character of each word in third column.
Enter a String
a is the first vowel
a 1 a
is 2 si
the 3 eht
first 5 tirsf
vowel 5 lowev
Hint: Use length(), indexOf(), substring() if required.
Array & split are not to be used
Create a program based on the sample output using while loop.
Enter a Number : 10
1*2 = 2
2*4 = 8
3*6 = 18
4*8 = 32
5*10 = 50
Input Combination
by CodeChum Admin
We’ve tried adding together integers, so how about adding characters as well? Well we really don't know how to create a variable that holds the combined characters (at least for now) so let's just print them together in 1 string instead.
Instructions:
Input two characters in one line, separated by a space.
Make the strings be printed out like it’s concatenated (or combined) by printing it without spaces in between. Refer to the sample output for your reference.
Input
A line containing two characters separated by a space.
A·B
Output
A line containing two characters.
AB
Integer Pairing
by CodeChum Admin
Now this one's a tad bit tricky, but you can definitely do it!
Instructions:
Input five integers in one line, with each integer separated by a space.
Add the 1st and 2nd integers together and store the sum inside a variable.
Add the 3rd and 4th integers together and store the sum inside a variable.
Multiply the two sums and raise the product result to the power of the 5th integer.
Print out the result.
Input
A line containing five integers separated by a space.
1·2·3·4·5
Output
A line containing an integer.
4084101