Posts

Showing posts with the label INPUT & OUTPUT

Selvan was playing with the a object of random size for stress relief. Selvan knows that the Length, Width, and Height of the object. But he would like to know the surface area of the object he is playing with. Can you help him in finding it?

 #include <stdio.h> int main() {     int length,width,height,surfacearea;     scanf("%d%d%d",&length,&width,&height);     surfacearea=2*((width*length)+(length*height)+(height*width));     printf("%d",surfacearea); return 0; }

Binita is playing a chess. The game will be played on a rectangular grid consisting of N rows and M columns. Initially all the cells of the grid are uncolored.Binita's initial score is zero. At each turn, he chooses some cell that is yet not colored, and colors that cell. The score obtained in this step will be number of neighboring colored cells of the cell that Binita colored in this step. Two cells are neighbors of each other if they share a side between them. The game will end when all the cells are colored. Finally, total score obtained at the end of the game will sum of score obtained in each turn.Binita wants to know what maximum score he can get? Can you please help him in finding this out?

 #include <stdio.h> int main() {     int n,m,a;     scanf("%d%d",&n,&m);     a=(((n-1)*(m-1)*(2)+m+n-2));     printf("%d",a); return 0; }

Ramesh is working in an engineering college hostel as a Mess supervisor. There are different messes are available based on the years. Every day students count is varying in all the hostels due to continuous holidays.Since ramesh is in charge of the cooking team. He had trouble with calculating the quantity of food that needs to be prepared because of the varying student count.Even if a small quantity of food is prepared by the cooking team, it should be divided equally among the number of Mess.Ramesh needs an automated software to identify the amount of food available (in number of packets ) and Mess count. Can you help him to divide the food equally and also calculating the remaining quantity of food that will be available after sharing the food equally ?

 #include <stdio.h> int main() {     int alvqntoffood,messcnt,dividedqnt,remfood;     scanf("%d",&alvqntoffood);     scanf("%d",&messcnt);     dividedqnt=alvqntoffood/messcnt;     remfood=alvqntoffood%messcnt;     printf("%d",dividedqnt);     printf(" ");     printf("%d",remfood); return 0; }

Tina's trainer have given her two positive integers U and V. Now her task is ti find the number of pairs of positive integers (X,Y) such that 1≤X≤U, 1≤Y≤V and X+Y is even.Tina is finding difficult to understand the problem.Can you help her solving the problem?

 #include <stdio.h> int main() {     int U,V;     scanf("%d%d",&U,&V);     printf("%d",(((U*V)+1)/2)); return 0; }

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. 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?

 #include <stdio.h> int main() {     char Asc;     scanf("%c",&Asc);     printf("%d",Asc); return 0; }

Binita was travelling from Chennai to Delhi in Rajdhani Express. The train have arrived at the destination later than the estimated time. So, Binita wants to know the total number of hours and minutes the train was delayed.Can you help Binita in finding the exact hour and time Rajdhani Express was delay on the day of Binita's journey?Print the Number of Hours and Minutes in a single line.

 #include <stdio.h> int main() {     int tot_mins,hrs,mins;     scanf("%d",&tot_mins);     hrs=tot_mins/60;     mins=tot_mins%60;     printf("%d Hours and %d Minutes",hrs,mins); return 0; }

Tamilselvan wanted to help the needy people on his birthday.So he started that from the temple where beggars are high in numbers.He checked his wallet to give them the money evenly. But only after taking out the wallet noticed he dosen't have enough money.But he has the amount in his UPI App.One person nearby noticed it and said he will provide him the minimum number of currency required if he transfers the amount to him through UPI App.Tamilselvan thought it would be better if there is any logic available to verify the correctness of the amount he gets from that personTamilselvan needs the amount only in the form of Rs.50, 20, 10, 5, 2, 1

 #include <stdio.h> int main() {int note50,note20,note10,note5,note2,note1,amount; note20=0;note10=0;note5=0;note2=0;note1=0; scanf("%d",&amount); int a=0,b=0,c=0,d=0,e=0; a=amount%50; note50=amount/50; if(a!=0){b=a%20;note20=a/20;} if(b!=0){c=b%10;note10=b/10;} if(c!=0){d=c%5;note5=c/5;} if(d!=0){e=d%2;note2=d/2;} note1=e/1; printf("50:%d\n20:%d\n10:%d\n5:%d\n2:%d\n1:%d",note50,note20,note10,note5,note2,note1); return 0;}

During the IPL Match between CSK and MI, as a part of IPL contest the question was asked to the fans.Who are all giving the correct answer to that question will get the free VIP box ticket for the Final for which CSK have already qualified .The question is convert given integer number to octal and hexadecimal number respectively.Abilash is an die heart CSK fan. Can you help him answer the question so that he can watch CSK play the final from VIP box?

 #include <stdio.h> int main() {int iplno; scanf("%d",&iplno); printf("%o\n%x",iplno,iplno); return 0;}

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.

 #include <stdio.h> int main() {float val1,val2,outcome; scanf("%f%f",&val1,&val2); outcome=val1*val2; printf("%0.4f",outcome); return 0;}

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?

 #include <stdio.h> int main(){     int billamt,amtgiven;     int remain,quot;     scanf("%d",&amtgiven);     scanf("%d",&billamt);     remain=amtgiven%billamt;     quot=amtgiven/billamt;     printf("Quotient:%d\n",quot);     printf("Remainder:%d",remain);     return 0;}

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 ?

 #include <stdio.h> int main() {float num1,num2; scanf("%f\n %f",&num1,&num2); double resnum1,resnum2; resnum1=num1; resnum2=num2; printf("%lf",resnum1); printf("\n%lf",resnum2);                return 0; }

A triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.

 #include <stdio.h> int main() {int a,b,c; scanf("%d %d %d",&a,&b,&c); if((a==c)*(c!=b)+(a==b)*(a!=c)+(b==c)&&(a!=b)==1) printf("Yes"); else printf("No"); }

Rathik organized technical round interview in Macrosoft for the set of computer science candidates. The problem is to perform addition, subtraction, multiplication, and division of given two numbers.Rathik have given the deadline of only 5 minutes to complete the problem.Can you Help the candidates to complete the problem within the specified time limit ?

 #include <stdio.h> int main() {   int testnum1,testnum2;     int sum,sub,mult,mod;     float div;     scanf("%d",&testnum1);     scanf("%d",&testnum2);     sum = testnum1+testnum2;     sub = testnum1-testnum2;     mult = testnum1*testnum2;     mod = testnum1%testnum2;     div = (float)testnum1/(float)testnum2;     printf("\nAddition : %d",sum);     printf("\nSubtraction : %d",sub);     printf("\nMultiplication : %d",mult);     printf("\nDivision : %0.3f",div);     printf("\nModulus : %d",mod); return 0; }

Elavenil runs a popular bakery in his native. Elavenil has now finished baking and frosting his cupcakes, it's time to package them. Elavenil has N cupcakes, and needs to decide how many cupcakes to place in each package. Each package must contain the same number of cupcakes. Elavenil will choose an integer A between 1 and N, inclusive, and place exactly A cupcakes into each package. Elavenil makes as many packages as possible. Elavenil then gets to eat the remaining cupcakes. Elavenil enjoys eating cupcakes very much. Help Elavenil choose the package size A that will let him eat as many cupcakes as possible.

 #include <stdio.h> int main(){     int n;     scanf("%d",&n);     printf("%d",(n/2)+1);     return 0;}

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 × n. 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.

 #include <stdio.h> int main() {int n,m,a;int stone; scanf("%d%d%d",&n,&m,&a); stone=((n+a-1)/a)*((m+a-1)/a); printf("%d",stone); return 0;}

Laasya bought a new volleyball in the sports shop. It looks like a medium size. 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?

 #include <stdio.h> int main() {     float radiusofball,volumeofball;     scanf("%f",&radiusofball);     volumeofball=(4.0/3.0)*3.14*radiusofball*radiusofball*radiusofball;     printf("%f",volumeofball);     return 0;}

In primary mathematics classes, you all have learned about profit and loss. If cost price is greater than selling price, then there is a loss otherwise profitCan you kindly automate the same?

 #include <stdio.h> int main() {int cp,sp,amt; scanf("%d",&cp); scanf("%d",&sp); if(cp>sp) {amt=cp-sp; printf("Loss:%d",amt);} else if(cp<sp) {amt=sp-cp; printf("Profit:%d",amt);} else printf("No Profit No Loss"); return 0; }

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?

 #include <stdio.h> int main(){     int num1,num2,num3;     int sum;     scanf("%d %d %d",&num1,&num2,&num3);     sum=num1+num2+num3;     printf("%d",sum);     return 0;}

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.What should be the length of RS? At one extreme LS can be vertical and at other RS can be vertical. find the minimum and maximum length of Rs.

 #include <stdio.h> #include <math.h> int main(){     float b,ls,rs1,rs2;     scanf("%f %f",&b,&ls);     rs1=sqrt((ls*ls)-(b*b));     rs2=sqrt((ls*ls)+(b*b));     printf("%0.5f %0.5f",rs1,rs2);     return 0;}

Tina's brother gave her a friendly task of calculating the number of squares in a board that has n*n squares of dimensions 1cm *1cm each.

#include <stdio.h> int main(){ int n;int j; scanf("%d",&n); j=(n*(n+1)*((2*n)+1))/6; printf("%d",j); return 0;}