‘12872, 712 PM Recore
Question 1
Problem Description:
Phoenix mall in the capital city of Washington and it is rectangular in shape when it is seen on the map with
the size n x m meters.
On the occasion of the jubilee anniversary, a decision was taken to pave the Square with square marbles
stones. Each stone is of the size n Xn
Can you what is the least number of stones needed to pave the Square?
It's allowed to cover the surface larger than the Mall Square, but the Square has to be covered.
It's not allowed to break the stones. The sides of stones should be side by side(parallel) to the sides of the
Square.
Constraints:
1sn<10°9
1
int main()
{
int nym,a;
int stones;
scanf("%d%d%d" , &n, &m, 8a) 5
stones=((n+a-1)/a)*((m+a-1)/a) 5
print#("%d" , stones) ;
return @;
}
Question 2
Problem Description:
Laasya bought a new volleyball in the sports shop. It looks like a medium size,
usr9128122, 712 PM Recors
She somehow found the radius of the sphere
But she would like to know the volume of that ball,
Can you help him in finding the Volume of the ball?
Functional Description:
Volume = (4.0/3.0) xm x 193
m= 3.14
Constraint
1.00
int main()
{
float radiusofball,volumeofball;
scanf("%F", &radiusofball);
volumeofball=((4.0/3.@)*3.14*radiusofball*radiusofball*radiusofball);
print#("%#", volumeofball) ;
return @;
y
Question 3
Problem Description:
Professor JD has lots of options. Bottles containing all types of potions are stacked on shelves which cover
the entire wall from floor to ceiling.
Professor JD has broken his bones several times while climbing the top shelf for retrieving a potion. He
decided to get a ladder for him.
But he has no time to visit Charu. So he instructed Bargav to make a ladder for him, Professor JD
specifically wants a step ladder that looks like an inverted 'V' from a side view.
Professor just mentioned two things before vanishing-
B - separation between left side (LS) and right side (RS) on the ground
LS - the length of left side
What should be the length of RS? At one extreme LS can be vertical and at other RS can be vertical.
2879128122, 712 PM Recors
Bargav is angry and confused.
Can you help him find the minimum and maximum length of RS.
Constraints
1=B
#include
int main(){
float b,1s,rsi,rs2;
scanf("%F%F", &b,&1s) 5
=b*b;
1s=1s*1s;
printf("%@.5f %8.5f",rs1,rs2);
return @;}
Question 4
Problem Description:
Nancy bought apples in a fruit shop.
The shop keeper specified the the bill amount, Nancy also given some amount to the shop keeper for paying
the bill.
But she likes to know the quotient and remainder after dividing the amount given by her by the bill amount
specified by shop keeper.
Can you help nancy in finding it?
Constraint
5 Sambgivens 2500
5 sbillamt < 2500
ais9128122, 712 PM Recors
Input Format:
First Line: Integer value of amtgiven representing the amount given by nancy.
Second Line: Integer value of billamt representing the amount specified by the shop keeper
Output Format
First Line: Print the Quotient in integer format.
Second Line: Print the Remainder in integer format,
Program Code:
#include
int main()
{
int remainder, quotient;
int billamt, amtgiven;
scanf("%d", &amtgiven);
scanf("%d", &billamt) ;
quotient=amtgiven/billamt;
remainder=amtgiven-quotient*billamt;
print#("Quotient :%d", quotient);
print#("\nRemainder:%d", remainder);
return @;
?
Question 5
Problem description:
Nathan works as an HR in a private company. He had an opportunity to interview students from various
disciplines.
He asked the candidates to perform the addition of two floating point numbers given by him an to print the
output with three values after decimal point, But the student failed a math test on adding two numbers. So
many students could not complete the first round,
One day Nathan is invited as a chief placement trainer in a reputed engineering college. He willing to know
how many students are capable of solving the same problem.
Can you solve the problem and prove him that you are capable of solving it?
Constraints:
1.00svarl<25000.00
1
int main()
{
float vari1,var2,res;
scanf("%F %#", &var1,&var2);
res=varltvar2;
print#("%.3f",res)5
return @;}
Question 6
Problem Description:
Arif came from a very low income family.
However, his father Irfan, sent him abroad for the purpose of studying.
Arif also concentrated well in his learning keeping in mind his father’s poverty.
Arif was excellent in mathematics.
One day Arif had a computer class and his computer teacher asked him to create a programming logic for the
mathematics problem of multiplying two numbers of type float.
Constraints:
1,00< varl <1000.00
1.005 var2<1000.00
Input Format:
The only line of input has two floating point numbers separated by space
Output Format:
In the only line of output print the result of the multiplication with 4 values after decimal point.
Program Code:
#include
int main()
{
float vali,val2,outcome;
scanf("%F%F" ,&val1,&val2) ;
outcome=val1*val2;
ss9128122, 712 PM Recors
print#("%.4", outcome) ;
return @;
?
Question 7
Problem Description:
On one beautiful Sunday Selvan went to Aaron's house for exam preparation.
They have decided to study Mathematics subject because they have exams by coming Monday, Aaron is a
master in Mathematics but Selvan is not so good in Mathematics so James trained with Selvan for getting a
high score in the exam,
After teaching some problems to Selvan.Aaron have given some tasks to Selvan to solve .
The problem is to convert input float into a double. Can you help Selvan in finding the solution ?
Constraints:
1.00
int main()
{float num, num2;
scanf("%F%F", &num1, &num2) 5
double resnum1,resnum2;
resnum1=num1;
resnum2=num2;
printf("XL#\n",resnum1);
printf("%1#",resnum2) ;
return @;
?
Question 8
Problem Description:
The employees of one million dollar profit company TeamZilla organised the strike because they want to
have additional salary increment, the strike is continuing for more than a month now.
esr9128122, 712 PM Recors
Rathik the CEO of TeamZilla has found the solution to break the strike, so he organised a small technical
competition for his employees.
Most of the employees who were part of the strike have participated in the technical event announced and in
‘that there was a task of printing the ASCII Value of the character inputted
Can you help them to complete the task and win the competition?
Constraint:
asAsc
int main()
{
char Asc;
scanf("%c",8ASC) 5
print#("%d", Asc);
return @;
y
Question 9
Problem Description:
Elavenil has a chessboard with N rows and M columns. In one step, he can choose two cells of the
chessboard which share a common edge (that has not been cut yet) and cut this edge.
Formally, the chessboard is split into two or more pieces if it is possible to partition its cells into two non-
empty subsets $1 and $2 (S1S2-G, |S1}+|S2|-NM) such that there is no pair of cells c1,e2 (¢1 €S1,c2€S2)
which share a common edge that has not been cut.
Elavenil does not want the board to split into two or more pieces. Compute the maximum number of steps he
can perform while satisfying this condition.
Constraints:
1SNM&8
Input Format:
The only line of input test case contains two space-separated integers N and M.
sr9128122, 712 PM Recors
Output Format:
In the only line of output print an integer representing the maximum possible number of steps.
Program Code:
#include
int main()
{
int nym;
scanf("%d %d", n,m) 5
print#("%d", (m-1)*(n-1))5
return @;}
Question 10
Problem Description:
Sajid was booking a train ticket from Chennai to Delhi for his family. Two of the relatives was interested in
Joining that journey from different places with their family members
So, Sajid booked tickets for those persons also along with his family members.
He wants to know the total number of tickets for this travel.
Can you help him in finding the total number of passengers?
Constraint:
Sajid has to declare three integer variables named as num], num2, num3,
1
int main()
{
int num1,num2,num3;
esr‘12872, 712 PM Recore
int sum;
scanf("%d %d %d", Anum, &num2, &num3) ;
sum=num1+num2+num3 ;
printf ("%d", sum) ;
return Q;
y
Question 11
Problem description
Pari is an Architect who is currently doing his design work for his new project in one of the congested
location of Paris.For making his work simpler he is looking for the automated tool which check whether the
area is greater or perimeter is greater or both are equal if the Length (L) and Breadth (B) of a rectangle is
provided.
Since he is not from the computing background he is looking for the freelancer who can do this for him?
Can you help him with the logic for doing so?
Constraints:
1
int main()
{int 1,b,area, peri;
scanf("%d\n%d" 81, &b) ;
*b5
*(14b) 5
if(area>peri)
print#("Area\n&d", area) ;
ois79128122, 712 PM Recors
else if(areacperi)
print#("Peri\n&d", peri) ;
else
print€("Eq\n%d", area) ;
return @;}
Question 12
Problem Description:
Laasya looking at the friends birthday list on a social media site likes to find if the particular person's
birthday year is a leap year or not.
Since many will have the same doubt she decides to automate the task by writing the code snippet for finding
the same but she don't know the logic to write it.
Can you help Laasya to accomplish her task?
Constraints:
1
= year<= 10000
Input Format:
The Single Line Containing the integer value representing year.
Output Format:
Print as either NOT A LEAP YEAR or LEAP YEAR after checking the year.
Program Code:
#include
int main()
{
int year;
scanf("%d", &year) ;
if((year%4==@) || (year%4ee==0))
printf("LEAP YEAR");
else
printf("NOT A LEAP YEAR");
return @;
y
Question 13
Problem Description:
The window of Vinod's room has a width of 'A',
There are two screens hung over the window, each of which has a horizontal length of 'B'. (Vertically, the
sereens are long enough to cover the whole window.)
101879128122, 712 PM Recors
‘We will close the window so as to minimize the total horizontal length of the uncovered part of the window.
Find the total horizontal length of the uncovered parts of the window then,
Constraints:
1<=A<=100
1<=B<= 100
A and B are integers,
Input Format:
Only line of input has two integers representing A and B respectively separated by a space.
Output Format:
Print the output in a single line the total horizontal length of the uncovered parts of the window.
Program Code:
#include
int main()
{
int A,B,cj
scanf("%d %d", 8A, 8B) ;
c=A-B*2;
print#("%d",c);
return 0;
y
Question 14
Problem Description:
Arav and Aaron are participating in the Bike racing. Arav have crossed some milestores earlier and Aaron
crossed some milestores earlier during their racing, because they have changed their speeds at different times.
Both of them like to know the difference in speeds between them at different stages of racing,
Can you help finding the speed difference between Arav and Aaron?
Constraints:
20¢ aravspeed <100
205 aaronspeed <100
Input Format
The first line of input represents the speed of Arav.
The second line of input represents the speed of Aaron,
Output Format:
Print difference between the driving speed of two participants in a single line.
wus79128122, 712 PM Recors
Program Code:
#include
int main()
{int aravspeed, aaronspeed, speeddiff;
scanf("%d%d" ,aravspeed, &aaronspeed) ;
if (aravspeed>aaronspeed) {
speeddi ff=aravspeed-aaronspeed;
print("%d", speeddi ff) ;
}
else{
speeddiff=aaronspeed-aravspeed;
printf ("%d", speeddiff) ;
>
return @;
+
Question 15
Problem Description:
Agathiyan is the Chief In charge for carrying out World Economic Survey in India.
As a part of survey his team have collected the salaries of the citizens of India,
The Salaries of different people are in different number of digits.
Now Agathiyan would like to classify the earnings of the citizen based on the number of digits of his/her
salary into 5 different categories as follows:
1 Insufficient Earning
2.Very Low Earning
Low Earning
4 Sufficient Earning
5.High Earning
Can you help him do the above classification if he gives the salary of the particular person to you as input?
Constraints:
0
int main()
{
int N5
scanf("%d" ,8N) ;
if(N<10)
printf("Insufficient Earning");
else if(N<1@0)
printf("Very Low Earning");
else if(N<1000)
printf("Low Earning");
else if(N<10000)
printf("Sufficient Earning");
else if(N>1¢000)
printf("High Earning");
return @;
}
Question 16
Problem Description
There are two monkeys on an x-axis ready to jump in the positive direction (i.e, toward positive infinity)
The first monkey starts at location x1 and moves at a rate of v1 meters per jump.
The second monkey starts at location x2. and moves at a rate of v2 meters per jump.
Given the starting locations and movement rates for each monkey, can you determine if they'll ever land at
the same location at the same time?
Constraints:
+ 05x1
int main()
{
int x1,x2,v1,v25
int i;
scanf("%d %d Kd Md", 8x1, &V1, &x2, &v2) 5
int m=x1,n=x2;
4F(x2>x1
)
{if (v2>v1){
printf("NO");
+
else {
for (51<10000;i++){
m=m+v1;
n=n+v2;
if(
nyt
printf ("YES");
break;
4879128122, 712 PM Recors
if (m!=n)
print#("NO");
y
+
return @;
+
Question 17
Problem Description:
Anegan is a member of a programming competition site, Awesome Coder.
Each member of the Awesome Coder is assigned two values: Inner Rating and Displayed Rating,
The Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or
more contests,
Otherwise, the Displayed Rating will be their Inner Rating minus 100 x (10-K) when the member has
participated in K contests,
Anegan has participated in N contests, and his Displayed Rating is R.
Find his Inner Rating.
Constraints:
All values in input are integers
1
int main()
{int njr5
scanf("%d %d",8n,&r) 5
if (n>=10)
printf("%d",r)5
else
printf("%d" ,r+(100*(19-n))) 5
return @;}
19187‘12872, 712 PM Record
Question 18
Problem Description:
The Election Commission of India distributed the voter ID to all eligible citizens,
But Amira didn't received a Voter ID on time.
So, she gets confused about her eligibility for voting?
Can you clarify her doubt?
Condition for Eligibility as per Election Commission of India is
(i) Eligible if age >=18
(i) Not Eligible if age <18
Constraints
Isages100
Input Format:
The only line of input has single value of type integer representing age.
Output Format:
Print as Eligible or Not Eligible based on the eligibility criteria in a single line,
Program Cod
#include
int main()
{
int age;
scanf("%d" ,&age) ;
if (age>=18)
printf("Eligible") ;
else
printf("Not Eligible");
return @;
+
Question 19
Problem Description:
‘Swathi is working in a world famous pizza restaurant,
Her manager ordered her to verify the size of the pizza such that it slices forms an exact triangle.
161879128122, 712 PM Recors
She was given 3 values representing three angles of the slices cut down by chefs and she has to find out
whether the slice is Valid or Not.
Can you help her in finding it?
Constraints:
30 <-anglel<= 90,
30 <-angle2<-90,
30<-angle3<-90
Note:
The Pizza Slice is Valid only if the sub of all the angle of the slice is equal to 180 degree.
Input Format:
Single line has three integer valu:
s separated by space representing three angles of the pizza slice
Output Format:
Print as "Pizza Slice is Valid" or "Pizza Slice is Not Valid" acco
sly.
Program Code:
#include
int main()
{
int angle1,angle2, angle3;
scanf("%d %d %d" , Bangle1, &angle2, 8angle3);
if (angle1+angle2+angle3==180)
printf("Pizza Slice is Valid");
else
printf("Pizza Slice is Not Valid");
return @;
y
Question 20
Problem Description:
In primary mathematics classes, you all have leamed about profit and loss.
If cost price is greater than selling price, then there is a loss otherwise profit
Can you kindly automate the same?
Constraints:
1000 Selling Price Print a “Loss” along with the amount of loss.
If Cost Price < Selling Price Print as "Profit" along with the amount of profit.
If Cost Price = Selling Price Print “No Profit No Loss”
Program Codi
#include
int main()
{
int cp,sp,amt;
scanf("%d%d" ,&cp, &sp) 5
if(sp>cp)
{
amt=sp-cp;
print#("Profit:%d", amt) ;
+
else if(cp>sp)
{
amt=cp-sp3
print#("Loss:%d", amt) ;
+
else
{
printf("No Profit No Loss");
181879128122, 712 PM Recors
+
return @;
+
Question 21
Problem Description:
Hamid likes all arrays equally. But he likes some arrays more equally than others, In particular, he loves
Rainbow Arrays.
An array is Rainbow if it has the following structure:
First al elements equal 1
Next a2 elements equal 2.
Next a3 elements equal 3.
Next a4 elements equal 4.
Next a5 elements equal 5.
Next a6 elements equal 6,
Next a7 elements equal 7.
Next a6 elements equal 6.
Next a5 elements equal 5.
Next a4 elements equal 4.
Next a3 elements equal 3.
Next a2 elements equal 2.
Next al elements equal 1.
ai can be any non-zero positive integer.
There are no other elements in array.
Help Hamid in finding out if the given array is a Rainbow Array or not.
Constraints:
1sT< 100
191879128122, 712 PM Recors
7
int main()
{
int t,i,N,flag=1,start, last;
int rainbowcheck[7]={1,2,3,4,5,6,7}3
scanf("%d" ,&t) 5
while(t
{flag=1;
scanf("%d" ,8N)
int A[N];
for(
int main()
{
int noofrowsinclass;
int i,
scanf("%d" ,&noofrowsinclass) ;
for (i=1;i<=noofrowsinclass}i++){
for (j=15 j<-isj++){
if (i%2==0)
printf("Fail ");
else
printf("Pass ");}
print#("\n")5
}
+
return @;
2087‘12872, 712 PM ocort
Question 32
Problem Description:
Raju the fan of Great Mathematician Ramanujan developed an encoder that encodes the first 16 lowercase
English letters using 4 bits each.
The first bit (from the left) of the code is 0 if the letter lies among the first 8 letters, else itis 1, signifying
that it lies among the last 8 letters.
The second bit of the code is 0 if the letter lies among the first 4 letters of those 8 letters found in the
previous step, else it's 1, signifying that it lies among the last 4 letters of those 8 letters.
Similarly, the third and the fourth bit each signify the half in which the letter lies.
Constraints:
1
#include
#include
void loop()
{
y
int main()
{
int t,n,j,b,k,i,ds
scanf("%d", &t) 5
while(t--)
{
int 1;
scanf("%d",&n) ;
char s[n];
scanf("%s",s)5
d=strlen(s) 5
-1; lens l++)
int z=((int)(s[b])-48);
k=k+(z*pow(2,j))3
bes;
}
k+=975
print#("%c",k)5
yprint#("\n");
}
return 0;
y
Question 33
Problem Description:
Nathan won the man of the match award in the recently concluded local tournament final, So the friends of
nathan have asked him to take them to cinemas as a trat for winning man of the mateh.But
20879128122, 712 PM Recors
Nathan is short of money to take them to cinemas so to postpone the cinema plan he tred to engage them
with the programming challenge.
The task was if the string $ was given they have to change the string according to the following condition:
If the first letter in a string is capital letter then change the full string to capital letters.
Else change the full string to small letters.
Constraints:
1
50,
1<[s[<104
Input Format:
The first line of input contains an integer T denoting the number of test cases.
Then T test cases follow. Bach test case contains a string S.
Output Format:
For each test case, print the changed string in a new line.
Program Cod:
#include
#include
int main()
{
int T,i;
scanf("%d", 87);
while(T--){
char s[100];
scanf("%s",s)5
if(isupper(s[@])){
for(i=1}i<=100;i++){
s[i]=toupper(s[i]);
}
}
else if(islower (s[@])){
for (i=131<=100; i++){
s[i]=tolower(s[i]);
}
}
printf ("%s\n"
y
return 0;
}
2579128122, 712 PM Recors
Question 34
Problem Description:
Arif likes to play volley ball. He found some statistics of matches which described who won the points in
order.
A game shall be won by the player first scoring 11 points except in the case when both players have 10
points each, then the game shall be won by the first player subsequently gaining a lead of 2 points.
Could you please help the Arif find out who the winner was from the given statistics? (It is guaranteed that
statistics represent always a valid, finished match.)
Constraints:
1
#include
#include
int main()
{char matchscenario[ 102];
int t,i,j, count=0;
scanf("%d" ,&t) 5
for (i=;ictsitt){
scanf("%s" ,matchscenario) ;
for(j=0; j
#include
int main()
{
char students[10@001] ;
int t,i;
int pair;
scant ("%d", &t) 5
while(t>@){
26879128122, 712 PM Recors
scanf("%s", students) ;
for(i=0;icstrlen(students) ;i++){
if(students[i]=="g'&&students[i+1]=:
{pairt+;
itt; }
else if(students[i]
{pairs+;
itt; } }
t-
print#("%d\n"
}
return 0;
y
b')
*b'8&students[i+1
pair);
Question 36
Problem Description:
Elavenil likes strings a lot but she likes palindromic strings even more. Today she found an old string
his garage. The string is so old that some of its characters have faded and are unidentifiable now.
Faded characters in the string are represented by ' whereas other characters are lower case Latin alphabets
ie faz’).
Elavenil being the palindrome lover decided to construct the lexicographically smallest palindrome by filling
each of the faded character ('.) with a lower case Latin alphabet. Can you please help her complete the task?
Constraints:
1sT<50
1<|s|< 500
String s consists of ['a'z'] and '! only.
Input Format:
First line of input contains a single integer 'T’ denoting the number of test cases. 'T' test cases follow.
First and the only line of each case contains string 's' denoting the old string that Roopa has found in his,
garage.
Output Format
Print lexicographically smallest palindrome after filling each faded character if itis possible to construct
one.
Print -1 otherwise.
Program Code:
#include
#include
int main()
{
int t5
2us7‘12872, 712 PM Recore
scanf("%d", &t) 5
while(t--){
char pali[seo];
int i,n,flag=0;
scanf("%s",pali);
n=strlen(pali);
For (iO; ipali[n-i-1])
pali(n-i-1]=pali[i];
else pali[i]=pali[n-i-1];
}
else{
if(pali[i]!=pali[n-i-1]){
flag=1;
break;
if(Flay
if(pali[n/2]
pali[n/2]='a';
>
if (flag)print#("-1\n") 5
else printf("%s\n", pali);
?
return @;
+
Question 37
Problem Description:
Jeferson was given a string s of length 8 consisting solely of ‘0's and "I's,
Assume that the characters of the string are written in a circular fashion.
Jeferson need to find the number of 0-1 or 1-0 transitions that one has to make while making a single
traversal over the string, ie. start from any character and go circularly until you get back to the same
character, and find the number of transitions that you made.
The string is said to be said to be uniform if there are at most two such transitions.
Otherwise, it is called non-uniform.
Given the string s, tell whether the string is uniform or not.9128122, 712 PM Recors
Constraints:
1
#include
int main(){
char arr[10];
int t,count=0,i;
scanf("%d" ,&t) 5
while(t!=
scanf("%s", arr);
for(i=0;icstrlen(arr);it++){
if(arr[i]!=arr[i+1])
count++;
}
count -
if(count<=2)
printf("uniform\n") ;
else printf("non-uniform\n");
te5
count=0;
}
return 0;
+
Question 38
Problem Description:
Mohit has no work to do in the kitchen, so he decided to play a card game with the following rules:
Initially, N cards are placed in a row on a table, Each card is placed either face up or face down.
The goal of the game is to remove all cards from the table, one by one.
‘A card may be removed only if it is currently facing up.
201579128122, 712 PM Recors
When a card is removed, its adjacent cards (the cards directly to its left and right, if they exist) are flipped,
i.e. a card that was facing up will be facing down and vice versa.
There is an empty space left behind each removed card, ie. the remaining cards are not moved to create a
contiguous row of cards ag:
Therefore, if the game starts with three cards and the middle card is removed, then the cards on the sides are
flipped, but removing one of these cards afterwards does not cause the other card to be flipped, since it is
only adjacent to the empty space created by removing the middle card.
Determine whether Mohit is able to win this game.
Constraints:
1
#include
int main()
{char s[1¢0002];
int test,i;int flag-0;
scanf("%d",&test) ;
while(test--){
scanf("%s",s)5
flag=0;
for(i=0;icstrlen(s)-15i++){
"1'| |sLit]=='0")
)printf("WIN\n");else printf("LOSE\n");
return @;
?
Question 39
30579128122, 712 PM Recors
Problem Description:
Every day, Selvan goes to his office by train and buys the ticket from the counter on the day of travel.
On the ticket, there is a letter-code that is represented as a string of upper-case Latin letters.
Selvan believes that the day will be successful in case exactly two different letters in the code alternate.
Otherwise, he believes that the day will be unlucky, Please see note section for formal definition of
alternating code.
If the ticket code is given. Please determine, whether the day will be successful for Selvan or not.
Print "Successful Day" or "Unsuccessful Day" (without quotes) corresponding to the situation,
Constraints:
1
#include
int main()
{
int ts
scanf("%d", &t) 5
while(t--){
char ticketnumber[102];
int i,x;
x=0;3
scanf("%s",ticketnumber) ;
if(strlen(ticketnumber)%2:
) printf ("NO\n");
else{
for (i=0;i0) printf("NO\n");
else printf("YES\n") ;
30879128122, 712 PM Recors
return @5
?
Question 40
Problem Description:
Janu and Ram are close friends who task a lot about life
They go though a lot of inspiring "Quotes of Life".
One fine day they had a small game. According to the game Ram will Read one of the Quote about life from
the book and Janu have to think a word about life in her mind without disclosing it to Ram.
Finally once Ram completed reading the quoted Jannu will say if the word she thought in her mind is there
in the Quote read by Ram,
Can you convert the same scenario to a programming logic ?
If the work thought by Jannu was present in the Quote then you have to print "Exists" else print "Dosen't
Exists".
Constraints:
1
#include
int main()
{
int t
scanf("%d",&t) ;
for(;t>0;t--){
char string[10@],s2[10001];
scanf("%s", string) ;
scanf("%s",S2)5
int a=strlen(s2);
an-5
if(strstr(string,s2)){
aus722.742 PM
printf("Exists\n")5
}
else printf("Dosen't Exists\n");
+
return @;
y
Question 41
Question Description:
Sajid is an eighth-grader in a CBSE school.
Recors
Although he scored well in many subjects, he did not an expert in computer programming languages.
But Sajid's computer examination is scheduled for next week.
As per the blueprint, many questions would come from the recursive function topic.
He collected previous year’s questions. one of the repeated questions is to calculate the factorial value for the
given number using a recursive function.
Can you help him to calculate the factorial using recursion?
Functional Description
51 =5*4*3*2*1 = 120
Constraints
1< num <1000
Input Format
Single-line represents an integer number.
Output Format:
The single line indicates the factorial value,
Refer sample input and output
Program Codi
#include
long facto(int n)
{ if (n>=1) return n#facto(n-1); else
30579128122, 712 PM Recors
return 1;}
int main()
{int q3
scanf("%d" ,&q) 5
printf ("%1d", facto(q))5
return @;}
Question 42
Question description
Issac is a Language teacher at a high school in Madurai,
Sabari is a student, he is studying programming while during Language class.
Issac tells Sabari to leave the other subject and learn Tamil
Sabari asked permission for 10 minutes, Finally, Sabri got permission to solve the program
The computer teacher has given homework on the topic of function and to write the program for conversion
of days into year, weeks, and days. . But Sabari is not good at C Programming,
Can you help him to solve the programming problem?
Constraints:
1< year <10000
1< week <100
I< day <100
Input Format:
Single line input indicates the number of Days.
Output Format:
Ina single line display days as number of Years, weeks, and days.
Program Code:
#include
int convert(int);
int main()
3579128122, 712 PM Recors
{
int d;
scanf("%d" 8d) ;
int weeks, days;
weeks=(d-convert (d)*365)/73
d-convert (d)*365)%7;
id Years %d Weeks %d Days", convert (d) weeks, days);
return @;
+
int convert(int ndays)
{
return ndays/365;
>
Question 43
Question description:
Advika is trying to solve the puzzle problem during Mathematics class hour, she has a graph paper with G X
N rows and columns, and the puzzle question is, an NCC training base in each cell for a total of G X N
bases. He wants to drop food items to every point based on strategic points on the graph paper, marking each
drop point with a red dot. If a base contains at least one food package inside or on top of its border fence,
then it's considered to be supplied.
For example: if Advika has four bases in a 2x2 grid. If he drops a single food package where the walls of all
four bases intersect, then those four cells can access the food package.
Exams Guppy Orope
{af jafay is
‘ala | [al
Given G and N, what's the minimum number of packages that Luke must drop to supply all of his bases?
Example :
G-2,N
Food Packages can be dropped at the corner between cells (0, 0), (0, 1), (1, 0), (1, 1) , (0, 2) and (1, 2). This
supplies all bases using packages,
Funetion Description:
© G: the number of rows
«Ne the number of columns
Constraints:
1s+X==10, 1=+¥==10
Input Format
Two space-separated integers describing the respective values of G and N.
sr9128122, 712 PM Recors
Output Format:
The only line of output has single integer indicating the minimum number of food packages required
Explanation
Luke has four bases in a 2X2 grid, If he drops a single package where the walls of all four bases intersect,
then those four cells can access the package:
‘na Paper ‘ad Sttion =
m=2 m=z as
a aja
rail AG supaly Drop
Because he managed to supply all four bases with a single supply drop, we print 1 as our answer.
Program Code:
#include
int NecCells(int x, int y){
int package;
package=((x+1)/2)*((y+1)/2)5
return package;
}
int main()
{
int G,N;
scanf("%d %d", 8G, &N) ;
int package;
package=NccCells(G,N) 5
printf("%d", package) ;
return @;
?
Question 44
Question description:
Hassan gets a job in a software company in Hyderabad, The training period for the first three months is
20000 salary. Then incremented to 25000 salaries.
Training is great but they will give you a programming task every day in three months. Hassan must finish it
in the allotted time. His teammate Jocelyn gives him a task.
What will be the value of the weight of a given number sequence? if Each number has a numeric index
equal to its sum of digits, the weight of the sequence is equal to its sum of the product of the position of the
number and its numeric index.
For Example sequence of 6 nos is as follows: 12 31 45 13 56 67
30579128122, 712 PM Recors
Hassan was given a sequence S with unique elements, can you help him to write a code to help him
determine the sequence S1, formed from S whose weight is maximum ?.
‘As multiple sequences can be formed when numbers have the same numeric index.
In this case, a maximum of 2 numbers will be given whose number index is the same.
Print all the sequence, the first number should be the smallest number that occurs before greater
Function Description:
weight = 3*1 + 4*2.4943 + 4%4 4 1145 + 13*6 = 187
100]
Input Format:
The first line of integer input represents a number of elements
The second line of integer input represents elements
Output Format
First line indicates the total weights of a given sequence
The second and third line indicates the possible sequence to get the highest weight,
The fourth line indicates Maximum sequence weight.
Program Code:
#include
#include
int numind(int n)
{
if(n==108) return 1;
int rem = n%10;
n = n/10;
return rem + n;
>
int main()
{
int n
scanf("%d",&n) 5
int arr[n],sum=@, i,j,k;
for(i=0;icnj++i)
{
scanf("%d", Barr[i]);
sum+=(i+1)*numind(arr[i])5
an8s79128122, 712 PM Recors
}
printf("Weight of given input sequence=%d\n", sum);
int foun
for(i=n-134
{
for (j=i-135>=0;
{
if(arr[i]
void asc_sort(int a[10@],int n);
int main()
{int n,a[100];
scanf("%d" ,&n) ;
asc_sort(a,n);
return @;
+
void asc_sort(int a[10@],int n){
int i,j,ts
for(i=@;icn;i++)
scanf("%d", &a[i]) 3
For(i=O;ialj]){
tealil;
afil-alj]s
ali
for(i=0;icnsitt)
printé("Xd ",a[i])s
y
Question 46
Question description
Queen Advika is planning an attack on King Irfan's Dawn of Titans.
King Irfan learns of this conspiracy from Karki Newton(bird) and plans to lock the single door through
which the enemy can enter his kingdom,
But, to lock the door he needs a digital key that is a palindrome,
He starts to go through his box of integers, checking to see if they can be rearranged into a palindrome.
30579128122, 712 PM Recors
Functional Description
the string “123123”
when you read the integer from left to right and right to the left side, the meaning should be the same.
If itis palindrome then print "YES" otherwise “NO”
Constraints
af1}
#include
int checkPali(int) ;
int n,t,rem,r=0;
int main(){
scanf("%d",&n) ;
checkPali(n)==0?print# ("YES") :printf("NO") ;
return 0;
+
int checkPali(int n){
ten;
while(n!=0){
r=r*10+n%10;
n/=105
}
if(rsst)return @;
else return 1}
}
Question 47
Question description
Simon celebrates his 25th birthday, Simon's older brother promised to buy
birthday if he could solve the question,
im a new motorbike on his
40579128122, 712 PM Recors
's brother is that our mother Binitta's birthday is Leap Year or not.
The question asked by Simpson’
Help him to solve this puzzle, then only he can celebrate his birthday happily.
Functional Description
year mod div by 4000 && year mod div by 100==0 or year mod div by 4==0
Constraints
1
int leap(int y)
{if(y%4 ==0)
printf("Leap Year");
else
printf("Not a Leap Year");
return 0;
+
int main()
{int y;
scanf("%d", &y)5
leap(y);
return @;
}
Question 48
Question description
Nancy, Simon, and Swati were all attending campus interviews. they got selected for the second round.
Nancy failed to clear the second round and others to selected for the next round of interviews.
Nancy discussed with her friend the question which came in the interview.
one of the questions was, to create a program for the Fibonacci series. Nance doesn't know, how to solve it.
But it’s in the syllabus of his exam, So can you help to create a program in the specified concept to get an
offer in the next interview ?.
Functional Description:
usr9128122, 712 PM Recors
‘The recursive function should be used to find the Fibonacci series.
Constraints
1s N 1000
Input Format
‘The single line represents an integer as a number.
Output Format,
The single line represents the Fibonacci series.
Refer sample input and output test cases.
Program Code:
#include
void getFibonacii(int a,int b,int n)
{
int ¢3
if(n>0)
{
c=atb;
printf("%d ",c);
getFibonacii(a,b,n-1);
}
}
int main()
{
int ),b=1,n5
scanf("%d",&n) 5
printf("%d %d ",0,1)5
getFibonacii(a,b,n-2);
return @;
?
Question 49
Question description
Simon is studying B.Tech.-Mechanical Engineering,
He's going to attend a computer science-based subject exam this semester.
Due to the less preparation in the previous monthly tests, his internal mark decreased
His computer science Professor made an offer one more chance to boost up his internal marks.
42579128122, 712 PM Recors
Professor assigns a program to Simon for the internal mark bootup.
So Simon wants to solve Questions of conversion from Binary to octal
can you help him in solving Questions by creating a function for the conversion of binary to octal?
Constraints
1s binary number <1000,
For Example, 1010101
Explanation
+ Consider the binary number 1111 which has to be converted to octal.
Divide the binary number into groups of three from right to left.
1111 can be grouped as 001 111 Now, find the octal number for each group.
Three-bit binary numbers from (000 to 111) have equal decimal and octal representations.
Hence, the octal numbers for binary numbers in the range (000 to 111) are same as that of the decimal
numbers. The octal number of 001 is 1 and 111 is 7. The octal equivalent of 1111 is 17,
Input Format:
Single-line represented an Input as an integer (010101) from the user
Output Format
Single line prints the “octal number” value.
Refer to Sample input and output test cases.
Program Code:
#include
#include
int convertBinarytoOctal(long long binaryNumber);
int main()
printf(
return @;
y
int convertBinarytoOctal(long long binaryNumber){
int oct=0,dec=@, i=@;
while(binaryNumber !=0){
dec+=(binaryNumber%10)*pow(2, i);
+i;
binaryNumber/=10;
}
while(dec!=0){
oct+=(dec%s) *i;
43579128122, 712 PM Recors
return oct;
y
Question 50
Question Description
Tina is a Bachelor of Computer Applications (BCA) student. During her final year Campus Interview, she
has an opportunity to get a job in a software company in Bangalore.
‘The company provides Five months training period with Rs.30000/month Package. Then it will be
incremented to Rs.55000 per month.
At the end of the training, the examination was conducted for all freshers, Tina got a question paper and one
of the questions comes under the concept of programming,
The program was, she has to calculate the sum of an array of elements using RECURSION to Complete One
of Her math Problem,
Tina does not know how to get the output for this program using recursion, So you have to help Tina get this
job.
Constraints:
a1] < arr < a[100]
1
int sum(int arr[],int start, int len);
int main()
{int N,i5
scanf("%d" ,8N) 5
int arr[N];
for (i=0;i
#include
int calculateLength(char* ch) {
int i=@;
itt;
ch++5
return i;
}
481579128122, 712 PM Recors
int main()
{
char a[151];
scanf("%s",a) 5
int l=strlen(a);
printf ("%d",1)5
return @;
}
Question 62
Question description
A video player plays a game in which the character competes in a hurdle race. Hurdles are of varying
heights, and the characters have a maximum height they can jump. There is a magic potion they can take that
will increase their maximum jump height by 'l' unit for each dose. How many doses of the potion must the
character take to be able to jump all of the hurdles. If the character can already clear all of the hurdles, return
0.
Constraint
I<=n, k<=10
1<=height{i] <=100
Input Format:
the number of hurdles, and the maximum
The first line contains two space-separated integers 'n’ and
height the character can jump naturally.
The second line contains 'n' space-separated integers height[i] where 0<=i
void 1(){ i#(®) printf("*h=(int *)malloc(n*sizeof(int));")3}
int main()
{
int i,a[100],n,max=0,k;
scanf("%d%d" ,&n, &k) 5
for(i=0;icnsit+)
40579128122, 712 PM Recors
{
scanf("%d",8a[i])5
if(max1000 print " INVALID INPUT".
Program Code:
#include
int main()
{
int t;
scanf("%i", &t);
if(!(t>@ && t <=1000))
{
printf("INVALID INPUT");
return @;
}
an87‘12872, 712 PM Record
while(t--)
{
int *ptr;
int n,i,total=t
scanf("%i", &n);
int numArray[n];
ptr=numArray;
for(is@; i
int compfunc(const void *a,const void *b){
return @;
}
int main()
{
int n,i,x;
scanf("%d" ,&n) ;
int a[1@0@00];
for(i=0;icnsit+)
{
scanf("%d",8a[i]) 5
y
for(i=0;icnsit+)
) continue;
xen px++)
if(a[x ) continue;
if(a[x]%a[i]==08&x!=i) a[x]=0;
}
+
for(i=0,x=0;icn;itt) if(ali]!=0)x++
printf("%d", x);
return @;}
Question 65
Question description
Amazon Prime announced a one-year subscription offer for technical students. we will provide two numbers
for the addition that must be use call by reference. If the answer is correct for this question, you will get the
offer. Can you complete the task to win this competition?
491579128122, 712 PM Recors
Constraints:
1<=a<=100
Input Format:
The input lines contain the positive integers "a" and "b"
Output Format:
Print the sum of numbers using call by referenc
Program Code:
#include
long addTwoNumbers(long *n1,long *n2){return @;}
int main()
{
int “ptr ,
‘gtr, first, second;
scanf("%i %i"
» &First, &second) ;
ptr = &first;
qtr = &second;
int sum = *ptr + *qtr;
printf (
» sum);
addTwoNumbers (0,0);
return 0;
}
Question 66
Question description
Hotstar announced an IPL offer for technical students. we will provide two numbers for the addition that
must be use pointer. If the answer is correct for this question, you will get the offer.
Can you solve this question to win in this competition?
mandatory: pointer
Constraints:
1<=a<=100
1<=b<=100
Input Format:
The input lines contain the positive integers "a" and "b"
500579128122, 712 PM Recors
Output Format:
Print the A sum of numbers using a pointer
Program Code:
#include
int main()
{int a,b, sum;
scant ("Xd %d",8a,8b) 5
int *ptr=8a, *qtr=8b;
sum=*ptr + *qtr;
printf("%d", sum) ;
return @;
+
Question 67
Problem Description:
Mukesh has given an array al,a2,...,an to Mahesh. Mahesh can remove at most one subsegment from it.
The remaining elements should be pairwise distinct.
In other words, at most one time Mahesh can choose two integers Land r (1
int compare(const void *a, const void *b)
{
return 1;
+
void sum();
int main()
{ sum();
return @;
}
S1579128122, 712 PM Recors
void sum()
{
int n,i,j, count:
scanf("%d",&n) ;
int arr[n];
for(isO;i < njit+)
{
scanf("%d", 8arr[i]);
}
for(i=0;icn;it+)
{
for(j=it1; jens j++)
{
if(arr[i]
count++5
}
}
print#("%d", count) ;
}
Question 68
arr[3])
Question Description:
Selvan went to the German for participating in the reality game show.
He wants to qualify as participants among all country students. if he g:
will be eligible for the next level.
ared the coding part then only he
He got the questions like, you have to read in an array of integers sequentially and print its elements in
reverse order.
Now Selvan wants to identify the logic of the coding part using a pointer and he has to display the correct
result then only he can participate in the game show.
Constraints:
1<=n<=10
Input Format:
The first-line indicates the 'n' array size.
The second line indicates inputs for the array,
Output Format:
Display numbers in descending order
Program Code:
#include
#include
int main(){
sus7‘12872, 712 PM Recore
int n,i;
scanf("%d" ,&n) 5
int arr[n];
for(i=0;icnji++)
scanf("%d",&arr[i])5
int *ptr;
ptr=8arr[0];
for(i=n-1;i>05i--)
printf("%d ",arr[i]);
print#("%d", *ptr);
return @;
}
Question 69
Question description
Yasir was traveling from Chennai to Bangalore by bus. He looking the LED display board for the destination
place name on the bus. But it shows the reflection of the destination place name in reverse. can you write the
code to change the display in reverse order?
Constraints:
1<=string<=15
Input Format:
The input line must be a string,
Output Format:
Print reverse a string.
Program Code:
#include
#include
int main()
{
int i;
char s[30];
fgets(s, 30, stdin);
for(i=strlen(s)-1; i
printf("%e", s[i])5
if(1>2)
printf("char *sptr\nchar *rptr");
return @;}
Question 70
Question description
sas79128122, 712 PM Recors
Hasan transporting some boxes through a tunnel, where each box is a parallelepiped and it is characterized
by its length, width, and height.
The height of the tunnel 42 feet and the width can be assumed to be infinite.
A box can be carried through the tunnel only if its height is strictly less than the tunnel’s height.
Find the volume of each box that can be successfully transported to the other end of the tunnel.
Note: Boxes cannot be rotated.
Constraints:
1<-n<=100
1
#include
void print();
int main()
{
print();
return 6;
}
void print()
{
int n =3,i;
int *boxes;
int box;
scanf("%i", box);
boxes = malloc(n * sizeof(box)) ;
while(box--)
{
for(izO; i < nz itt)
scanf("%i", (boxes+i));
if(*(boxes+2)<42)
{
int total = (*boxes)*(*(boxes+1))*(*(boxes+2)) ;
printf("%i\n", total);
54579128122, 712 PM Recors
}
}
y
Question 96
Problem Description:
Ragu has given 3 integers A, B, and N to Dhamo.
Now Ragu asked Dhamo to calculate the maximum possible value of :
floor(Ax/B)-A * floor(x/B) for a non-negative integer 'x' not greater than 'N’
Here floor(t) denotes the greatest integer not greater than the real numbe
Can you help Dhamo ?
Constraints:
Input Format:
Input is given from Standard Input in the following format:
ABN
Output Format:
Print the output in a single line to calculate the maximum possible value of floor(Ax/B)-A * floor(x/B) for a
non-negative integer 'x’ not greater than 'N’
Program Code:
#include
#define min(a,b) ((a)>(b)?(b):(a))
void 1(){}
int main(void){
long a, b, n;
scanf("%1d Xld %1d",8a,&,8n) 5
print#("X1d", a*min(b-1, n)/b);
if(@)printf("y=(double)a y=y/(double)b") ;
return @;}
Question 98
Problem description:
Ameer is afiaid of number 21 and if he comes across that number then he may faint and you can not let it
happen.
You do not want him to face a number that has 21 as a part of them or in the worst ease possible is divisible
by2I
58579128122, 712 PM Recors
It he ends up facing such a number he feels sad.... and no one wants that - because he starts chanting
"NUMBER 21" if the number doesn't make him feel sad he says "I AM SAFE"
Constraints:
1
#include
#include
int main()
{
int t,i,j,lp3
static int n;
char _num[1¢0000] ;
scanf("%d",8n) 5
for(i=0;icnsitt)
{
scanf("%s", num) ;
|, t=8, 1=0;
=strlen(num);
‘toi (num) ;
while(j<=1)
{
if(num[3]
tet
jes
}
if((t>=1) || (p%21 == @))
printf ("SAVE ME\n");
else printf("I AM SAFE\n");
}
return @;
y
Question 99
"2" 8& num[j+2]
505722.742 PM Recore
Problem Description:
Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively.
An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which
cach hand rotates clockwise at constant angular velocity.
It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.
At 0'o clock, the two hands overlap each other. H hours and M minutes later, what is the distance in
centimeters between the unfixed endpoints of the hands?
Constraints:
1<=A,B <= 1000
OSHS
0<—=M<=59
Input Format:
Input is given from Standard Input in the following format:
ABHM
Output Format:
Print the output in a single line of the answer without units. Your output will be accepted when its absolute or
relative error from the correct value is at most
Program Code:
#include
#include
define pi 3.14159265358979323846
int main()
{
int A,B,H,M;
scant ("%d %d %d %d", 8A, &B, 8H, 8M) ;
double h=(double) (H+M/60.@);
printf("%.1@1f\n",sqrt(A * A+B *B-2*A*B* cos(H / 6.0*MPI-M* 11
360.0 * M_PI)));
return @;
printf("%L#",h) 3
}
S187