There are N filled balloons
each painted with a random number B(i) where i is from 1 to N and the balloons
are tied up to a rope in a straight line. M kids who play football arrive and
they decide to burst the balloons with the numbers divisibl...
A string S is passed as the input. A positive integer X
is also passed as the input. The program must print the characters at positions
which are multiples of X.
Input Format: The first line contains S. The second
line contains X.
Outpu...
In a train journey,
there are N stations between station A and B (The train starts from station A).
The number of passengers who alighted in station B is passed as the input. The
number of passengers who alighted and boarded in the N stations i...
Given a number N, the program must print the pattern as
described below.
Input
Format: The first line contains the value of the N which
represent the number N.
Boundary
Conditions: 2 <= N <= 9
Output
Format: The pattern as described ...
In a social network, a person can invite friends of
his/her friend. John wants to invite and add new friends. Complete the program
below so that it prints the names of the persons to whom John can send a friend
request.
Input Format: The fir...
A number N is passed as the input. The program must print
the number of steps required for the program to reach Collatz sequence (that is
reach 1).
Collatz
Sequence: Suppose we select some initial number N and then build
the sequence of valu...