Avatar

Control Statement 10

C++ program to find factorial of a positive integer entered by user. Test Case 1 Input (stdin) 5 Expected Output 120 Test Case 2 Input (stdin) 6 Expected Output 720 ...

Avatar

Control Statement 6

Problem Description Write a program which takes input 10 integer array which contains positive and negative numbers and find out the average of positive and average of negative numbers. Test Case 1 Input (stdin) 10 5 -5 -10 2 -2 -3 3 15 -15 ...

Avatar

Method Overloading

Using a class and required methods Overload the unary logical NOT(!) operator Test Case 1 Input (stdin) 4 Expected Output 4 0 Test Case 2 Input (stdin) 10 Expected Output 10 0 ...

Avatar

CONCATENATE TWO STRINGS

Write a c++ program for Concatenate Two Strings without using strcat() function Test Case 1 Input (stdin) Kaveri river Expected Output Kaveririver Test Case 2 Input (stdin) Hello World Expected Output HelloWorld ...

Avatar

Prime numbers between two intervals

Write a program to find the Prime Numbers Between two Intervals with using function Test Case 1 Input (stdin) 23 78 Expected Output Prime numbers between 23 and 78 are: 29 31 37 41 43 47 53 59 61 67 71 73 Test Case 2 Input (stdin) ...

Avatar

Word Index 3

Write a C program to search all occurrences of a word in given string using loop Array Index starts from 0 ...

Avatar

STRING FACTOR

The success of IEEE code-quest depends on number of times the factor is present in a given string.Help core members to find them Factor of string is defined as a substring.In this case it's '01'. Input First line of input contains an integer T, de ...

Avatar

Complex Class

Perform addition operation on complex data using class and object. The program should ask for real and imaginary part of two complex numbers, and display the real and imaginary parts of their sum. Test Case 1 Input (stdin) 10 5 5 3 Expecte ...

Avatar

Table of a number

Write a program to print the table of a given number Test Case 1 Input (stdin) 5 Expected Output 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 5*6=30 5*7=35 5*8=40 5*9=45 5*10=50 Test Case 2 Input (stdin) 3 Expected ...

Avatar

Number Series 3

Write a program to Calculate (1) + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n) series Test Case 1 Input (stdin) 10 Expected Output 220 Test Case 2 Input (stdin) 9 Expected Output 165 ...

Avatar

Wrong Bill Calculation

In Ciel's restaurant, a waiter is training. Since the waiter isn't good at arithmetic, sometimes he gives guests wrong change. Ciel gives him a simple problem. What is A-B (A minus B) ? Surprisingly, his answer is wrong. To be more precise, his answ ...

Avatar

Odd sum

Write a program to print the sum of first n odd numbers Test Case 1 Input (stdin) 5 Expected Output 25 Test Case 2 Input (stdin) 7 Expected Output 49 ...

Avatar

DECIMAL TO OCTAL CONVERSION - CPPIOA003

Can you help your digital design faculty in correcting the assignment on number conversions decimal number to its equivalent octal number. by writing a program to convert a decimal number to its equivalent octal number. Input and Output Format : ...

Avatar

Check validity of a triangle

Write a program to check whether a triangle is valid or not, when the three angles of the triangle are entered by the user. A triangle is valid if the sum of all the three angles is equal to 180 degrees. Test Case 1 Input (stdin) 60 60 60 ...

Avatar

Control Statement 11

Write a program which takes input as integer and display the binary triangle on the basis of input integer. Example: 1.If user gives input 5 then the binary triangle should be like this : Test Case 1 Input (stdin) 5 Expected Output 1 ...

Avatar

STUDYING ALPHABET

Not everyone probably knows that Chef has younder brother Jeff. Currently Jeff learns to read. He knows some subset of the letter of Latin alphabet. In order to help Jeff to study, Chef gave him a book with the text consisting of N words. Jeff can r ...

Avatar

convert a string to lowercase.

Write a program to convert a string to lowercase. Test Case 1 Input (stdin) ProGramminG Expected Output programming Test Case 2 Input (stdin) InDia Expected Output india ...

Avatar

Remove all characters except alphabets

Write a simple C++ program to remove all special characters and numbers except Alphabets from the given string Test Case 1 Input (stdin) C*kl/d Expected Output Ckld Test Case 2 Input (stdin) h#E))L= Expected Output hEL ...

Avatar

Reverse the string

Reverse each word in a sentence Test Case 1 Input (stdin) great programmers Expected Output taerg sremmargorp Test Case 2 Input (stdin) wonderful work Expected Output lufrednow krow ...

Avatar

Sort words in Dictionary order

Program takes the words from the user and sort them in lexicographical(Dictionary) order. Input: 5 (Number of Words) Test Case 1 Input (stdin) zz gg ww qq aa Expected Output aa gg qq ww zz Test Case 2 Input ( ...

Avatar

count the vowels,consonants,digits and white spaces

Count and display the vowels, consonant, digits and white spaces in a given sentence Test Case 1 Input (stdin) I11WI19LLSO77LVE26IT13SURE66LY Expected Output Vowels:7 Consonants:11 Digits:12 White spaces:0 Test Case 2 Input (s ...

Avatar

Find Frequency of Characters of a String Object

Write a simple C++ program to find the number of occurances of a character in a given string. Test Case 1 Input (stdin) balaraja a Expected Output 4 Test Case 2 Input (stdin) rajivkumar r Expected Output 2 ...

Avatar

Read Name and roll number

Example Program Simple Class Example Program In C++ Test Case 1 Input (stdin) saa 101 Expected Output saa 101 Test Case 2 Input (stdin) kumar 201 Expected Output kumar 201 ...

Avatar

Armstrong number

A positive integer is called an Armstrong number if the sum of cubes of individual digit is equal to that number itself. Test Case 1 Input (stdin) 153 Expected Output Is an Armstrong number Test Case 2 Input (stdin) 15 Expected Out ...

Avatar

add two complex numbers

C++ program to add two complex numbers by passing objects to a function Test Case 1 Input (stdin) 7 -2 1 6 Expected Output 8+4i Test Case 2 Input (stdin) 70 -2 1 8 Expected Output 71+6i ...

Avatar

Display time

C++ program to display time using class Test Case 1 Input (stdin) 12 13 10 Expected Output 12:13:10 Test Case 2 Input (stdin) 10 12 10 Expected Output 10:12:10 ...

Avatar

DISTANCE CLASS

Write a C++ program using class with data members int feet, float inches to represent distance and define function that takes two distance values as arguments and returns the larger one. Include a main program that accepts two distance figures from t ...

Avatar

Find Leap Year

Program to find Leap Year using object and class Test Case 1 Input (stdin) 2000 Expected Output It is a Leap Year! Test Case 2 Input (stdin) 2001 Expected Output It is not a Leap Year! ...

Avatar

area of a rectangle

Calculate the area of a rectangle and display it. Test Case 1 Input (stdin) 5 5 Expected Output 25 10 Test Case 2 Input (stdin) 7 6 Expected Output 42 10 ...

Avatar

Prime number

a function that receives two numbers as an argument and display all prime numbers between these two numbers. Call this function from main( ). Test Case 1 Input (stdin) 1 10 Expected Output 2 3 5 7 Test Case 2 Input (stdin) 88 ...

Avatar

Function Overloading

using function overloading concept two functions can have same name if number and/or type of arguments passed are different Test Case 1 Input (stdin) 5.5 Expected Output 5 0.5 Test Case 2 Input (stdin) 6.3 Expected Output 6 ...

Avatar

Call by Reference

Swap Elements Using Call by Reference Test Case 1 Input (stdin) 5 6 3 Expected Output 3 5 6 Test Case 2 Input (stdin) 8 3 7 Expected Output 7 8 3 ...

Avatar

Time Difference

Find the time difference of two time period (H:M:S)using function Test Case 1 Input (stdin) 11 8 55 8 4 22 Expected Output 11:8:55 - 8:4:22 = 3:4:33 Test Case 2 Input (stdin) 6 4 33 4 8 11 ...

Avatar

Financial Crisis

Rishab owns a rectangular plot of land . Due to certain financial problems , he wishes to sell some parts of his plot. Rishab finds out that square shaped plots sell better than rectangular ones . With this in mind, he decides to divide his plot into ...

Avatar

calculate area of circle

Write a program to calculate area of circle. Test Case 1 Input (stdin) 56 Expected Output 9847.04 Test Case 2 Input (stdin) 36 Expected Output 4069.44 ...

Avatar

Leap year or not

Write a C++ program to find the year is leap year or not Test Case 1 Input (stdin) 2000 Expected Output The year is leap year Test Case 2 Input (stdin) 2111 Expected Output The year is not leap year ...

Avatar

Farenheit to celcius

Write a program which accept temperature in Farenheit and print it in celcius Test Case 1 Input (stdin) 99.5 Expected Output 37.5C Test Case 2 Input (stdin) 98.2 Expected Output 36.7778C ...

Avatar

VIVA ON EVEN NUMBERS - CPPIOA001

A maths teacher asks her students to give 3 examples for positive even numbers. When the student specifies a correct answer, his/her score is incremented by 1. When the student specifies a positive odd number, his/her score is decremented by 0.5. ...

Avatar

Vowels and Consonants

Find the total number of vowels and consonants in a given string Test Case 1 Input (stdin) abcde Expected Output VOWELS:2 CONSONANTS:3 Test Case 2 Input (stdin) srmuniv Expected Output VOWELS:2 CONSONANTS:5 ...

Avatar

Star Pattern 1

Print the following pattern of star, taking numbers of rows as an input. Following is an example of input-5 * ** *** **** ***** Test Case 1 Input (stdin) 5 Expected Output * ** *** **** ***** Test Case 2 Input (stdin) ...

Avatar

Print the Age

Use Standard input stream to print the input data entered by the user. Test Case 1 Input (stdin) 5 Expected Output 5 Test Case 2 Input (stdin) 100 Expected Output 100 ...

Avatar

Subtracton table

Write a program to display the subtraction table Test Case 1 Input (stdin) 7 13 Expected Output 7 - 1 = 6 7 - 2 = 5 7 - 3 = 4 7 - 4 = 3 7 - 5 = 2 7 - 6 = 1 7 - 7 = 0 7 - 8 = -1 7 - 9 = -2 7 - 10 = -3 7 - 11 ...

Avatar

Half Star Pyramid

Program to print half pyramid using * Input :The number of lines of the pyramid * * * * * * * * * * * * * * * Test Case 1 Input (stdin) 5 Expected Output * * * * * * * * * * * * * * * Test Case 2 Input (stdin) ...

Avatar

Find Max and Min

Write a program to enter the numbers till the user wants and at the end it should display the maximum and minimum number entered. Test Case 1 Input (stdin) 56 y 34 y 23 y 67 y 89 y 100 n Expected Output Max ...

Avatar

Calculate total expenses

Write a program to calculate the total expenses. Quantity and price per item are input by the user and discount of 10% is offered if the expense is more than 5000. Test Case 1 Input (stdin) 500 5 Expected Output 2500 Test Case 2 ...

Avatar

sum of digits

Write a c++ program to find the sum of digits of the given number Test Case 1 Input (stdin) 1234 Expected Output The sum is 10 Test Case 2 Input (stdin) 367 Expected Output The sum is 16 ...

Avatar

Math Table - Addition

Karthik need to teach his sister about tables.He need to write a program that get a number as an input and prints the table values up to 10. Test Case 1 Input (stdin) 2 Expected Output 1+2=3 2+2=4 3+2=5 4+2=6 5+2=7 6+2=8 ...

Avatar

REPLACE WORDS IN A STRING

Take a string as input from the user. Take two words as input, the word which the user wants to replace and its substitute Test Case 1 Input (stdin) SRMuniveristychennai chennai potheri Expected Output SRMuniveristypotheri Test Case ...

Avatar

REVERSE STRING

Write a program which takes input as string and then implement the logic to reverse this string. Example : 1.If string is "programr" then the output should be: rmargorp 2.If string is "helloworld" then the output should be: dlrowolleh Test ...

Avatar

Baby Name

Jessie is searching for better name for her new born boy baby. She expects the suggestions from her kith and kin. She accepts the name only if its matched with its reverse form. Help her to check the name satisfy the condition or not by automating th ...

Avatar

Perfect String

Harish develops a dictionary game that accepts only perfect string. A string is perfect if the string contains the (string length / 2) numbers of vowels . The game displays "Perfect" in case of perfect string or displays "Wrong Input" Test Cas ...

Avatar

Delete word from string

Following C++ program ask to the user to enter a sentence then ask to enter a word to be delete from the sentence, then display the new sentence after deleting the given word: Test Case 1 Input (stdin) welcome srm university srm Expected O ...

Avatar

INCREMENTING STRING

Write a program that takes a string as input from the user and increments all characters of the string by 1. Test Case 1 Input (stdin) JOHN Expected Output KPIO Test Case 2 Input (stdin) Hello Expected Output Ifmmp ...

Avatar

FREQUENCY OF CHARACTERS

Find the Frequency of Characters in a string Refer Sample Input and Output. Input 1: india b Output 1: 0 Input 2: srmuniversity s Output 2: 2 Test Case 1 Input (stdin) india i Expected Output 2 Test Case 2 Input ...

Avatar

case conversion

Kiran is a programmer he is interested to create a program to convert upper case letters present in a string into lower case letters. Test Case 1 Input (stdin) RajKUMAR Expected Output rajkumar Test Case 2 Input (stdin) maniKANDAN ...

Avatar

STRING MANIPULATION

Write a program that will ask the user to enter a string. You need to display the string in such a way that each word is displayed on a separate line. Test Case 1 Input (stdin) university Expected Output u n i v e r s ...

Avatar

Mark Sheet

Create a C++ class for student having following members. Rollno Name Number of subjects Marks of each subject (Number of subjects varies for each student) Write a parameterized constructor which initializes rollno,name & Number of subjects and ...

Avatar

Area of a Rectangle using Copy Constructor

Design a class rectangle with length and breadth as members, constructor, parameterized constructor, copy constructor, calcarea() and displayarea() as member functions. Create three objects r1, r2 and r3. Read length and breadth as input from u ...

Avatar

Bank Class

Define a class to represent a bank account which includes following members : Data members 1)Name 2)Account number 3)Type of account 4)Balance amt Member functions a.To assign initial value b.To deposit an account c.To withdraw an account ...

Avatar

Adding two Complex Numbers

Develop a class complex with real, imag members and getdata(), displaydata() and add() to read, display and add complex numbers respectively. Note: add() must have complex object as an argument and return type. Input: The first line of the input ...

Avatar

Student Average calculation

Crate a simple class with attributes name,rollno,total,average. Define a method to get input from the user for the following attributes name,rollno,total.Define another method to calculate the average & print all those attributes as output Test Case ...

Avatar

Good Number

Write a simple c++ class to print the number of zeros in the given input no. if no zeros available in that number, it should print as "good number" otherwise it should print the no of zeros in the given no. Test Case 1 Input (stdin) 10000 Exp ...

Avatar

Sum of two Measurements using Objects as Arguments

Develop a class "measure" with members feet(int) and inches (float) with member functions get(), diplay() and sum() to read, print and add two distances respectively. Note: The member function sum take object of measure class as an argument. Input ...

Avatar

concatenate empty

Write a simple C++ program to concatenate the 3 strings given by the user by using classes and objects. If any of the string is empty, it should print as "Invalid Input" otherwise it should print the concatenation of those 3 strings Test Case 1 I ...

Avatar

Addition of All

Write a program to add numbers and strings by overloading the function add.Addition should include integers,float and strings. Input : First line contains two integers. Second line contains two floating point numbers. Third line contains two stri ...

Avatar

Function types

No arguments passed but a return value Test Case 1 Input (stdin) 18 Expected Output 18 Test Case 2 Input (stdin) 5 Expected Output 5 ...

Avatar

Sum of given numbers

Assume that the program has three functions to perform addition. The first accepts two integers, second accepts three arguments and third accepts four integers and returns the sum of given numbers Test Case 1 Input (stdin) 10 20 30 40 ...

Avatar

Function types

No arguments passed and no return value Test Case 1 Input (stdin) 5 Expected Output 5 is a prime Test Case 2 Input (stdin) 4 Expected Output 4 is not a prime ...

Avatar

Checking for equality

Write a program to overload functions to find the two given integer and floating number are equal Test Case 1 Input (stdin) 10 10 25.5 25.5 Expected Output The numbers are equal The numbers are equal Test Case 2 Input (stdi ...

Avatar

Sum of square of given numbers

Assume that the program has overloaded functions to perform sum of square of given number. The first accepts two integers, second accepts three arguments, fourth accepts four arguments and calculates the sum of square of given numbers Test Case 1 ...

Avatar

Largest element in an array

Get n number of elements of an array from the user and find the largest number in the array Test Case 1 Input (stdin) 4 4 3 2 1 Expected Output Largest element=4 Test Case 2 Input (stdin) 6 1 2 3 4 5 6 Expected Output Larg ...

Avatar

Segregate 0s and 1s in an array

You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array. Traverse array only once. Input array = [0, 1, 0, 1, 0, 0, 1, 1, 1, 0] Output array = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] Test Case 1 ...

Avatar

Perfect Quadruples

Chang was not able to sleep well last night as he was thinking about a problem which still remains unsolved. Since he has only a day left to solve this problem and hand it to the interviewer, you being his friend decide to help him solve this so that ...

Avatar

Largest Permutation

Given a permutation of first n natural numbers as array and an integer k. Print the lexicographically largest permutation after at most k swaps Input: arr[] = {4, 5, 2, 1, 3} k = 3 Output: 5 4 3 2 1 Explanation: Swap 1st and 2nd elements: 5 4 ...

Avatar

Multiplication

Write a C++ Program - Multiply Two Numbers using Pointer. Test Case 1 Input (stdin) 5 5 Expected Output 25 Test Case 2 Input (stdin) 89 100 Expected Output 8900 ...

Avatar

Lexicographical Order

Write a Program to Sort Elements in Lexicographical Order (Dictionary Order) Test Case 1 Input (stdin) C C++ Java Python Perl R Matlab Ruby JavaScript PHP Ex ...

Avatar

Increment 1

Declare a pointer and initialize a variable to some value. Store the address of the variable to the pointer and Increment by 11 using pointer and print the value. Test Case 1 Input (stdin) 5 Expected Output 16 Test Case 2 Input (stdin) ...

Avatar

Odd Occurring in List

Given an array of positive integers. All numbers occur even number of times except one number which occurs odd number of times. Find the number in O(n) time & constant space. Example: I/P = [1, 2, 3, 2, 3, 1, 3] O/P = 3 Test Case 1 Input (st ...

Avatar

Subtract Matrics

Following C++ program ask to the user to enter any two 3*3 array elements to subtract them i.e., Matrix1 - Matrix2, then display the subtracted result of the two matrices (Matrix3) on the screen Test Case 1 Input (stdin) 8 6 2 9 5 ...

Avatar

Largest integer value

Write a C++ program to find the max of an integral data set. The program will ask the user to input the number of data values in the set and each value. The program prints on screen a pointer that points to the max value. Test Case 1 Input (stdin ...

Avatar

Increment 2

Declare a pointer initialize the pointer to NULL and initialize two variables to some values. Store the address of the first variable to the pointer and Increment by 11 using pointer and print the value. Now change the pointer to address to other var ...

Avatar

Operator overloading

Write a program to take intger as input and pass the value to method declared in class. Test Case 1 Input (stdin) 2 5 Expected Output Count:3 Test Case 2 Input (stdin) 4 7 Expected Output Count:3 ...

Avatar

Most Frequent Element

Write a program that determines the most frequent element in a given array. Test Case 1 Input (stdin) 5 1 2 3 4 1 Expected Output 1 Test Case 2 Input (stdin) 9 1 2 3 4 5 6 7 7 7 Expected Output 7 ...

Avatar

String Concatenation

Write a program to overload the += operator to perform concatenation of a character to a string. Test Case 1 Input (stdin) hello e Expected Output helloe Test Case 2 Input (stdin) \"= +\" Expected Output \"=+\" ...

Avatar

Find no of notes

Write a program which accepts amount as integer and display total number of Notes of Rs. 500, 100, 50, 20, 10, 5 and 1. For example, when user enter a number, 575, the results would be like this... 500: 1 100: 0 50: 1 20: 1 10: 0 5: 1 1: 0 ...

Avatar

Decimel Increment

Write a program to overload the prefix increment operator ++ to increment the digit after decimal. Input : A double value Test Case 1 Input (stdin) 12.7 Expected Output 12.8 Test Case 2 Input (stdin) 0.1 Expected Output 0.2 ...

Avatar

String concatenations

Write a program to concatenate two strings. Test Case 1 Input (stdin) ab b b Expected Output ab b b abbb Test Case 2 Input (stdin) aa yy uu Expected Output aa yy uu aayyuu ...

Avatar

Add two complex numbers

using binary operator '+' and to add two set of complex numbers. Sample: 2 set of variable each variable should contain 2 real numbers. By giving those real numbers the program intake as a imaginary values and add those values. Test Case 1 Input ...

Avatar

Palindrome

In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick. He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or ...

Avatar

Arithemetic operators

Write program for different working of operator in sequence :+,-,*,/,%,++,--. Test Case 1 Input (stdin) 5 2 Expected Output 7 3 10 2 1 5 6 Test Case 2 Input (stdin) 5 3 Expected Output 8 2 1 ...

Avatar

Divide using try catch

The user will enter numerator and denominator. If the denominator is zero, an exception will be generated using throw statement and the denominator will be passed as parameter with the exception. The only catch block we have accepts integer parameter ...

Avatar

Root of the problem

Chef has a binary tree. The binary tree consists of 1 or more nodes. Each node has a unique integer id. Each node has up to 2 children, which are identified by their ids, and each node is the child of at most 1 other node. A node X is considered t ...

Avatar

Input in variable but display by pointer

Take input in variable and display same value by pointer Test Case 1 Input (stdin) 5 Expected Output 5 Test Case 2 Input (stdin) 65 Expected Output 65 ...

Avatar

Destructor

Use destructor function, and perform exceptional handling Test Case 1 Input (stdin) 0 Expected Output Constructing object number 0 Constructing object number 1 Constructing object number 2 Constructing object number 3 Construct ...

Avatar

Display Programmer informations

Program to create a programmer derived from employee which is himself derived from person using Multilevel Inheritance Test Case 1 Input (stdin) Arun 21 Male CTS 15000 3 Expected Output Name: Arun Age: 21 Gender: Mal ...

Avatar

Create a File

Write a C++ Program to check whether a file is created or not Test Case 1 Input (stdin) sample1.txt Expected Output File Create Successfully Test Case 2 Input (stdin) test.txt Expected Output File Create Successfully ...

Avatar

Multiple catch

Two input values are entered. By using multiple try catch statement the programmer have to print first value as it is and second values ascii value Test Case 1 Input (stdin) 5 B Expected Output Testing multiple catches: Catch a integer ...

Avatar

Checking Valid Data

Check entered student mark is valid or not Test Case 1 Input (stdin) 125 Expected Output Invalid Mark Test Case 2 Input (stdin) -5 Expected Output Invalid Mark ...

Avatar

Constructor and Destructor

Vasu wants to know how constructor of base class and derived class works. (Constructor should have same name as class name) Test Case 1 Input (stdin) 1 Expected Output Base default constructor Base default constructor Derived defa ...

Avatar

User defined Exception

Write a cpp program to Handle User defined Exceptions such as Divide by zero. Test Case 1 Input (stdin) 10 0 Expected Output Divide by zero exception Test Case 2 Input (stdin) 15 5 Expected Output 3 ...

Avatar

Math Table

Karthik need to teach his sister about tables.He need to write a program that get a number as an input and prints the table values up to 10. Test Case 1 Input (stdin) 2 Expected Output 1x2=2 2x2=4 3x2=6 4x2=8 5x2=10 6x2=12 ...

Avatar

Square and Square root

Square a number and root of a number calculate using inheritance Test Case 1 Input (stdin) 2 25 Expected Output 45 Test Case 2 Input (stdin) 5 100 Expected Output 2 ...

Avatar

Area

Vasu has a home and like to find the area of the same (Hint: Class C1 gets length and breadth as input which is used by class C2 derived from C1. C2 displays the area of the same) Test Case 1 Input (stdin) 20 30 Expected Output 600 T ...

Avatar

String concatenation

C++ Program to Concatenate Two Strings using Operator Overloading Test Case 1 Input (stdin) Happy Programming Expected Output HappyProgramming Test Case 2 Input (stdin) Happy:) world Expected Output Happy:)worldsolut ...

Avatar

Copy String

Write a program to overload the == operator to perform copying of a string from one to another. Test Case 1 Input (stdin) hello Expected Output Copied String is:hello Test Case 2 Input (stdin) SrmUniversity Expected Output ...

Avatar

Compare two strings

Write c++ program to compare two strings with necessary exception handling functions Refer sample input and output Input 1: 1113 output 1: Invalid Input Input 2: SRM SRM output 2: SRM IS SRM Input 3: sRM sRm Output 3: sRM IS ...

Avatar

Multiple Catch Statements

Write c++ program to handle multiple exception catch block, default catch block and re-throwing exceptions. Get two inputs from the user and the input is 0 or less than or character, string then display the exception as "Wrong Input" Mandatory: ...

Avatar

Division Alphabets

Write c++ program to check the given string is palindrome or not with necessary exception handling functions. Input : Alphabets only allowed Refer sample input and output: Input 1: MADAM Output 1: MADAM is Palindrome Input 2: SRM Outpu ...

Avatar

Shape Class

Write a program that defines a shape class with a constructor that gives value to width and height. The define two sub-classes triangle and rectangle, that calculate the area of the shape area (). In the main, define two variables a triangle an ...

Avatar

Average

Write a function calculateAverage() which takes four int arguments which are marks for four courses in the semester and returns their average as a float. The calculateAverage() function should take only valid range for marks which is between ...

Avatar

Number format exception - String

Write c++ program to find number format exception with necessary exception handling functions Refer sample input and output: Input 1: 12.22 Output 1: Number format exception Input 2: 22 Output 2: Number format exception Input 3: e ...

Avatar

Number Series 5

Write a Program to print given series:1 2 4 8 16 32 64 128... Test Case 1 Input (stdin) 5 Expected Output 1 2 4 8 16 Test Case 2 Input (stdin) 7 Expected Output 1 2 4 8 16 32 64 ...

Avatar

Number Series 7

Write a program to print the given series upto first n digits Test Case 1 Input (stdin) 5 Expected Output 1 1 2 6 24 Test Case 2 Input (stdin) 7 Expected Output 1 1 2 6 24 120 720 ...

Avatar

DECIMAL TO BINARY - CPPIOA004

Can you help your digital design faculty in correcting the assignment on number conversions decimal number to its equivalent binary number. by writing a program to convert a decimal number to its equivalent binary number. Input and Output Format : ...

Avatar

Number Series 4

Write a Program to Print Series 1 -4 7 -10 . . . Test Case 1 Input (stdin) 5 Expected Output 1 -4 7 -10 13 Test Case 2 Input (stdin) 7 Expected Output 1 -4 7 -10 13 -16 19 ...

Avatar

Buzz Fizz

Write a program in C which prints the numbers from 1 to 100. But, multiples of 3 should be replaced with "Fizz", multiples of 5 should be replaced with "Buzz" and multiples of both 3 and 5 should be replaced with "FizzBuzz" Test Case 1 Input (std ...

Avatar

Cost of Painting

Vasu needs her home painted at cost of Rs. 5 per sq.feet. She needs to get perimeter value to find the cost of painting the house. (Hint: Class C1 gets length and breadth as input which is used by class C2 derived from C1. C2 calculates perimeter of ...

Avatar

Number Series 2

Write a program to Calculate (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + ... + (n*n) series Test Case 1 Input (stdin) 10 Expected Output 385 Test Case 2 Input (stdin) 20 Expected Output 2870 ...

Avatar

Carry Method

Write a Program to Generate Random Numbers Using Multiply with Carry Method Test Case 1 Input (stdin) 2 Expected Output 795 382 1487 260 475 1798 1347 722 1389 63 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

DECIMAL TO HEXADECIMAL CONVERSION - CPPIOA002

Can you help your digital design faculty in correcting the assignment on number conversions decimal number to its equivalent hexadecimal number. By writing a program to convert a decimal number to its equivalent hexadecimal number. Input and Outpu ...

Avatar

DECIMAL TO HEXADECIMAL CONVERSION - CPPIOA002

Write a program and input two integers in main and pass them to default constructor of the class. Show the result of the addition of two numbers. Test Case 1 Input (stdin) 5 6 Expected Output 11 Test Case 2 Input (stdin) 11 13 Expe ...

Avatar

India Vs Australia

Virat Kohli has won the toss against Australia in a 50 Over World Cup Final 2019. During the Toss time the commentator have him a funny task to test his mathematical skills. Shastri was the umpire to judge his mathematical skills. When the number ...

Avatar

DECIMAL TO BINARY - CPPIOA006

Write a C++ Program to Find the Binary Value of Decimal Number Using for loop Test Case 1 Input (stdin) 2 Expected Output 10 Test Case 2 Input (stdin) 10 Expected Output 1010 ...

Avatar

Control Statement 9

Write a program which takes integer number and prints the table of this number. Test Case 1 Input (stdin) 2 Expected Output 2 4 6 8 10 12 14 16 18 20 Test Case 2 Input (stdin) 5 Expected Output 5 10 ...

Avatar

Control Statement 2

Write a program which takes input Hours, Minutes, Seconds as integer and Calculates the total number of seconds. Test Case 1 Input (stdin) 10 50 10 Expected Output Seconds=39010 Test Case 2 Input (stdin) 20 30 20 Expect ...

Avatar

Reverse a Number

Write a program which takes input Hours, Minutes, Seconds as integer and Calculates the total number of seconds. Test Case 1 Input (stdin) 10 50 10 Expected Output Seconds=39010 Test Case 2 Input (stdin) 20 30 20 Expect ...

Avatar

Perimeter

The perimeter of this rectangle is 7+3+7+3 = 20. Example: The perimeter of this regular pentagon is 3+3+3+3+3 = 53 = 15. The perimeter of a circle is called the circumference: Circumference = 2pi*radius. Test Case 1 Input (stdin) 10 15 Exp ...

Avatar

Factorial Program

C++ Program to find Factorial of a number using class Test Case 1 Input (stdin) 4 Expected Output Factorial of 4 is : 24 Test Case 2 Input (stdin) 6 Expected Output Factorial of 6 is : 720 ...

Avatar

Control Statement 6

Write a program which takes input 10 integer array which contains positive and negative numbers and find out the average of positive and average of negative numbers. Test Case 1 Input (stdin) 10 5 -5 -10 2 -2 -3 3 15 -15 Expected Output Th ...

Avatar

Control Statement 10

C++ program to find factorial of a positive integer entered by user. Test Case 1 Input (stdin) 5 Expected Output 120 Test Case 2 Input (stdin) 6 Expected Output 720 ...

Avatar

Control Statement 8

Write a program which validates whether the given input year is Leap or Not Leap. For Ex: 1) if user inputs 2008 then program should print ""Leap"". 2) if user inputs 2009 then program should print ""Not leap"" Test Case 1 Input (stdin) ...

Avatar

Help Raj - Game 2

Try the following example. Ramu was given a game by his friend raj. When raj says a number then raj needs to tell that number. And when Raj says a word or character he has to remain silent. Kindly help Raju and Ramu to solve the task. Refer ...

Avatar

Control Statement 8

Write a program which validates whether the given input year is Leap or Not Leap. For Ex: 1) if user inputs 2008 then program should print ""Leap"". 2) if user inputs 2009 then program should print ""Not leap"" Test Case 1 Input (stdin) ...

Avatar

SAMPLE 001

Write a program to calculate the total expenses. Quantity and price per item are input by the user and discount of 20% is offered if the expense is more than 10000. Test Case 1 Input (stdin) 50 1000 Expected Output Total Expense is Rs. ...

Avatar

Enormous Input Test

The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data p ...

Avatar

Divide by Zero

Divide two numbers. Throw an exception if the denominator is 0 and display "EXCEPTION". If denominator is not 0, display "VALID". Test Case 1 Input (stdin) 10 0 Expected Output EXCEPTION Not possible Test Case 2 Input (stdin) 10 ...

Avatar

Ciel and A-B Problem

In Ciel's restaurant, a waiter is training. Since the waiter isn't good at arithmetic, sometimes he gives guests wrong change. Ciel gives him a simple problem. What is A-B (A minus B) ? Surprisingly, his answer is wrong. To be more precise, his an ...

Avatar

Adding Numbers

Ram has newly joined in the XXX bank. He had stuck in tallying the accounts in the month end. Help him to tally the accounts by summing up the credits to the bank for that month Test Case 1 Input (stdin) 10 2 Expe ...

Avatar

Time Files

write and read time in/from binary file using fstream in c++ Test Case 1 Input (stdin) 10 10 15 Expected Output Time 10:10:15 has been written into file The time is 10:10:15 Test Case 2 Input (stdin) 20 20 25 Expected Output ...

Avatar

RECTANGLE - CPPIOU002

Write a program to find the Area and Perimeter of a Rectangle Hint: area=height*width Perimeter=2*(height+width) Test Case 1 Input (stdin) 20 5 Expected Output Area of Rectangle=100 Perimeter of rectangle=50 Test Case 2 ...

Avatar

Words Swap

Hemanica is interested in developing word game which accepts two strings into two variables then swaps the strings of the variables and print it. Test Case 1 Input (stdin) arun kumar Expected Output kumar arun Test Case 2 Input (stdin) ...

Avatar

Calculate the s.i

Write a program which accept principle, rate and time from user and print the simple interest. Test Case 1 Input (stdin) 5000 15 2 Expected Output 1500 Test Case 2 Input (stdin) 2000 10 1 Expected Output 200 ...

Avatar

AGE IN FIVE YEARS

Robot needs to ask user for their name. Then display their name to prove that you can recall it. Ask them for their age. Then display what their age would be five years from now. Then display what was their age five years ago. Test Case 1 Input ( ...

Avatar

Display the factors

Write a program to display all factors of given number Test Case 1 Input (stdin) 60 Expected Output Factors of 60 are: 1 2 3 4 5 6 10 12 15 20 ...

Avatar

Average

Write a program using class to find average of five numbers. Test Case 1 Input (stdin) 1 2 3 4 5 Expected Output 3 Test Case 2 Input (stdin) 10 9 8 7 6 Expected Output 8 ...

Avatar

Check whether year is a leap year or not

Any year is input by the user. Write a program to determine whether the year is a leap year or not. Test Case 1 Input (stdin) 2016 Expected Output It is a leap year Test Case 2 Input (stdin) 2017 Expected Output It is not ...

Avatar

Biggest No

Write a simple c++ class to print the largest number among three numbers. If any one of the input is 0 then print as " Invalid Input". Test Case 1 Input (stdin) 5 6 7 Expected Output 7 Test Case 2 Input (stdin) 100 200 0 Expected O ...

Avatar

GCD

Program to find GCD of two given numbers Test Case 1 Input (stdin) 25 5 Expected Output 5 Test Case 2 Input (stdin) 32 84 Expected Output 4 ...

Avatar

Leap year or not

Write a C++ program to find the year is leap year or not Test Case 1 Input (stdin) 2000 Expected Output The year is leap year Test Case 2 Input (stdin) 2111 Expected Output The y ...

Avatar

Area of a Rectangle using Overloaded Constructors

Design a class rectangle with length and breadth as members, constructor, parameterized constructor, calcarea() and displayarea() as member functions. Create two objects r1 and r2. Read length and breadth as input from user and pass them to r2 ...

Avatar

Factorial of a given number

Write a C++ program to find the factorial of a given number Test Case 1 Input (stdin) 4 Expected Output The factorial is 24 Test Case 2 Input (stdin) 5 Expected Output The factorial is 120 ...

Avatar

ATM

Pooja would like to withdraw X $US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank charges). For each successful ...

Avatar

EQUAL OR NOT

Your Task is to read two strings from the user and check if they are equal or not. If equal print 1 else 0 Note: Ignore Cases, Refer sample input and output: Input 1: eye EYE Output 1: 1 Input 2: srm SrM Output:1 Input 3: SRM ...

Avatar

Adding Digits

Write a C++ Program to Add Digits of Number using pointer. Test Case 1 Input (stdin) 23 Expected Output The sum of the digits of 23 is 5 Test Case 2 Input (stdin) 6474 Expected Output The sum of the digits of 6474 is 21 ...

Avatar

Parameterized Constructor for Library Details

Design a class called library holding name, roll number, book code and counter. Also, define a parameterized constructor to initialize roll number, name and book code, member function show to display the book issue details and count to display counte ...

Avatar

MUL

Write a program with a function that takes two int parameters, mulitply them together, then returns the result. The program should ask the user for two numbers, then call the function with the numbers as arguments, and tell the user the multiplicatio ...

Avatar

Class Book

t Case 1 Input (stdin) 1234 DSP 560 7 Expected Output Total cost is 3920 Test Case 2 Input (stdin) 6789 CA 390 3 Expected Output Total cost is 1170 ...

Avatar

Student Details using Default Constructor

er function read() only with s1 and display() with s1 and s2. Data for Default Constructor Nikhil 20 165.5 58.2 Test Case 1 Input (stdin) Richard 95 168.5 65.3 Expected Output Richard 95 168.5 65.3 Nikhil 20 165.5 58.2 Test Cas ...

Avatar

Function types

Arguments passed and a return value. Test Case 1 Input (stdin) 25 64 Expected Output result:89 Test Case 2 Input (stdin) 79 11 Expected Output result:90 ...

Avatar

Swap data

Program to swap data using function templates. Test Case 1 Input (stdin) 4 3 2.1 1.2 d f Expected Output Before passing data to function template. i1 = 4 i2 = 3 f1 = 2.1 f2 = 1.2 c1 = d c2 = f After pa ...

Avatar

Maximum of two numbers

Write a programs to find the greatest of two integers, floating numbers by overloading functions Test Case 1 Input (stdin) 10 20 12.5 8.98 Expected Output The greatest no is 20 The greatest no is 12.5 Test Case 2 Inpu ...

Avatar

Function types

Arguments passed but no return value Test Case 1 Input (stdin) 10 20 Expected Output 30 Test Case 2 Input (stdin) 29 52 Expected Output 81 ...

Avatar

String palindrome

Overload ! operator to check string palindrom Test Case 1 Input (stdin) racecar Expected Output It is a palindrome Test Case 2 Input (stdin) madame Expected Output It is not a palindrome ...

Avatar

Add

Add two numbers using function Test Case 1 Input (stdin) 8 -4 Expected Output 4 Test Case 2 Input (stdin) 8 5 Expected Output 13 ...

Avatar

Raising Power

Raising a number to power n means multiplying the number p times.Write a program to find the power of both double and integer type using function overloading.Input:First line contains float value and its power Second line contains integer value and ...

Avatar

Check Adam

If a number when reversed , the square of the number and the square of the reversed number should be numbers which are reverse of each other For Example: 12^2 = 144 21^2 = 441 144 is the palindrome of 441 441 is the palindrome of 441 So, ...

Avatar

Array Elements Using Pointer

Write a Program to Accessing the array element using pointer which entered by the user Test Case 1 Input (stdin) 3 2 4 5 6 Expected Output You entered: 3 2 4 5 6 Test Case 2 Input (stdin) 12 34 2 ...

Avatar

GCD AND LCM

Java Program to Find the GCD and LCM of two Numbers Test Case 1 Input (stdin) 15 25 Expected Output The GCD of two numbers is: 5 The LCM of two numbers is: 75 Test Case 2 Input (stdin) 5 8 Expected Output The GCD of two ...

Avatar

GPA

C++ Program to store GPA of n number of students and display it where n is the number of students entered by user. Test Case 1 Input (stdin) 4 2.3 4.2 3.1 2.2 Expected Output Displaying GPA of students Student1=2.3 Stud ...

Avatar

String palindrome

Overload ! operator to check string palindrom Test Case 1 Input (stdin) racecar Expected Output It is a palindrome Test Case 2 Input (stdin) madame Expected Output It is not a palindrome ...

Avatar

Access Array Elements Using Pointer

The five elements are entered by the user and stored in the integer array data. Then, the data array is accessed using a for loop and each element in the array is printed onto the screen. Test Case 1 Input (stdin) 1 2 3 4 5 6 ...

Avatar

Multiple Inheritance 1

Write a program that calculates the area and perimeter of an rectangle but, to perform this program, multiple inheritance is used. Test Case 1 Input (stdin) 5.1 2.3 Expected Output 11.73 14.8 Test Case 2 Input (stdin) 1.5 2.5 ...

Avatar

Display the value given value using pointer

Display the given value and using pointer concept. Test Case 1 Input (stdin) 10 2 3 4 5 6 7 8 9 10 1 Expected Output 2 3 4 5 6 7 8 9 10 1 Test Case 2 Input (stdin) 7 2 4 8 12 14 18 20 Expected Output 2 4 8 12 14 18 ...

Avatar

Pointer basic

This program asks the user to enter integers as inputs to be stored in the variables 'a' and 'b' respectively. There are also two integer pointers named ptrA and ptrB. Assign the values of 'a' and 'b' to ptrA and ptrB respectively, and dis ...

Avatar

Checking Valid Data

Check entered student mark is valid or not Test Case 1 Input (stdin) 125 Expected Output Invalid Mark Test Case 2 Input (stdin) -5 Expected Output Invalid Mark ...

Avatar

SHAPE CLASS

Write a program that defines a shape class with a constructor that gives value to width and height. The define two sub-classes triangle and rectangle, that calculate the area of the shape area (). In the main, define two variables a triangle and a re ...

Avatar

Find Largest value

Program to display largest among two numbers using function templates. Test Case 1 Input (stdin) 4 5 2.5 3.2 a d Expected Output 5 is larger. 3.2 is larger. d has larger ASCII value. Test Case 2 Input (stdin) ...

Avatar

Reverse

Write a program to reverse an array Example: Input should be six characters or numbers Test Case 1 Input (stdin) 6 1 2 3 4 5 6 Expected Output 6 5 4 3 2 1 Test Case 2 Input (stdin) 6 9 8 7 6 5 4 Expected Output 4 5 ...

Avatar

Area of square and circle

Write a program to find the area of square and circle with using pure virtual function Test Case 1 Input (stdin) 4 5 Expected Output Area of square: 16 Area of circle: 78.5 Test Case 2 Input (stdin) 7 4 Expected Outp ...

Avatar

Square and cube

Calculates square and cube of given number using hierarchical inheritance Test Case 1 Input (stdin) 10 200 Expected Output Square is: 100 Cube is: 8000000 Test Case 2 Input (stdin) 4 5 Expected Output Square is: 16 ...

Avatar

Integer is positive or negative

Program to check whether an integer is positive or negative Test Case 1 Input (stdin) 33 Expected Output You entered a positive integer Test Case 2 Input (stdin) -5 Expected Output You entered a negative integer ...

Avatar

Chef and The Right Triangles

The Chef is given a list of N triangles. Each triangle is identfied by the coordinates of its three corners in the 2-D cartesian plane. His job is to figure out how many of the given triangles are right triangles. A right triangle is a triangle in wh ...

Avatar

Star Diamond

Write a program to print diamond of numbers. * * * * * * * * * * * * * * * * Test Case 1 Input (stdin) 7 Expected Output * ** *** **** *** ** * Test Case 2 Input (stdin) 5 Expected Output * ** *** ...

Avatar

Distance Interpretation

When we travel positive distance means travelling forward and negative means travelling backwards Write a program by overloading the unary + and unary - operator to display the same.Create a class Distance(feet,inches) and apply negation on the ob ...

Avatar

Exchange

Write a program to exchange the values of integer,float and character using function overloading. Input: First line contains Two integer numbers Second line contains Two floating point numbers Third line contains Two characters Test Case 1 In ...

Avatar

Check even or odd

Write a program to check whether the given number is even or odd (using ? : ternary operator ) Test Case 1 Input (stdin) 5 Expected Output Number is odd Test Case 2 Input (stdin) 2 Expe ...

Avatar

Check even or odd

Write a program to check whether the given number is even or odd (using ? : ternary operator ) Test Case 1 Input (stdin) 5 Expected Output Number is odd Test Case 2 Input (stdin) 2 Expected Output Number is even ...

Avatar

PATTERN 3 - CL2

"Write a java program to display the following patterns " Test Case 1 Input (stdin) 5 Expected Output * ** *** **** ***** Test Case 2 Input (stdin) 4 Expected Output * ** *** **** ...

Avatar

Unary operator overloading

Write a program to demonstrate unary operator overloading Test Case 1 Input (stdin) 5 5 5 Expected Output -5 -5 -5 Test Case 2 Input (stdin) 2 5 8 Expected Output -2 -5 -8 ...

Avatar

Adding and two objects

using binary operator overloading program in c++ , create a class and 3 object. Give two set of input for object 1 and two set of input in object2. sample: object1(x1,y1), here the values are given in float values. Test Case 1 Input ( ...

Avatar

The AND Gate

Construct an N input AND Gate. An AND Gate returns 1 if all its inputs are 1, otherwise 0. Input: The first line of input takes the number of test cases, T. Then T test cases follow. Each test case consists of 2 lines. The first line of e ...

Avatar

Perimeter

The perimeter of this rectangle is 7+3+7+3 = 20. Example: The perimeter of this regular pentagon is 3+3+3+3+3 = 53 = 15. The perimeter of a circle is called the circumference: Circumference = 2pi*radius. Test Case 1 Input (stdin) 10 15 Exp ...

Avatar

Distance Comparizon

The perimeter of this rectangle is 7+3+7+3 = 20. Example: The perimeter of this regular pentagon is 3+3+3+3+3 = 53 = 15. The perimeter of a circle is called the circumference: Circumference = 2pi*radius. Test Case 1 Input (stdin) 10 15 Exp ...

Avatar

swap without third variable

Write a program to swap value of two variables without using third variable Test Case 1 Input (stdin) 5 3 Expected Output 3 5 Test Case 2 Input (stdin) 7 3 Expected Output 3 7 ...

Avatar

Post Increment and Decrement

Overload the post increment and decrement operator.Check to see the limit of the hours lies between 0-23, the minutes lies between 0-59. Test Case 1 Input (stdin) 3 20 Expected Output H:3 M:21 H:3 M:22 Test Case 2 Input (stdin) ...

Avatar

Star Pattern 2

Write a program to print the star pattern Input:Number of rows Output:Star pattern Refer sample input and output for formatting specification. Test Case 1 Input (stdin) 6 Expected Output * ** *** **** * ...

Avatar

MOTHER CLASS

Write a program with a mother class and an inherited daughter class. Both of them should have a method void display ()that prints a message (different for mother and daughter).In the main define a daughter and call the display() method on it. Test C ...

Avatar

Post Increment and Decrement

Overload the post increment and decrement operator.Check to see the limit of the hours lies between 0-23, the minutes lies between 0-59. Test Case 1 Input (stdin) 3 20 Expected Output H:3 M:21 H:3 M:22 Test Case 2 Input (stdin) ...

Avatar

Addition of Two Numbers

write java program to find the addition of two Numbers. get the two integer numbers at the run time . add that two numbers then print the value with at-least two decimal place. Note: inputs may whole number or fractional number output should pr ...

Avatar

Division Operator

Perform division operation use general purpose catch block with parameters which shows it will catch all the exceptions. Now if the denominator is 0 or negative, in both the cases the generalized catch block will be executed and the statement There i ...

Avatar

Three Way Communications

The Chef likes to stay in touch with his staff. So, the Chef, the head server, and the sous-chef all carry two-way transceivers so they can stay in constant contact. Of course, these transceivers have a limited range so if two are too far apart, they ...

Avatar

Debug the program - Float

Debug the program and get the desired output: #include #include using namespace std; int main(void) { cout << "Start" << endl; try { char s; cout << "Inside try block." << endl; throw s; cout << "This will not execut ...

Avatar

Check the Scientist

Armstrong was one of the great scientist. The Indian council decided that we need to assign some number as a gift to the great scientist. There was a suggestion given by the Indian Council. If the sum of cube of each number is again equal to the ...

Avatar

DIFFERENZIA

In a country named Differenzia, the minors and senior citizens are not eligible to vote. Only people aged between 18 to 60 (both inclusive) are eligible to vote. Write a program to determine a person in Differenzia is eligible to vote. Example: ...

Avatar

COMPARING TWO STRINGS

Write a program to input two strings from user and find whether these strings are equal or unequal without using string functions. Test Case 1 Input (stdin) elab universitylearningcentre Expected Output THE GIVEN TWO STRINGS ARE NOT ...

Avatar

Square and cube

Write a C++ program using class to calculate area of a square and cube of given number using inline function Test Case 1 Input (stdin) 4 Expected Output Area of the square=16 Volume of the cube=64 Te ...

Avatar

Reverse

Write a program to reverse an array Example: Input should be six characters or numbers Test Case 1 Input (stdin) 6 1 2 3 4 5 6 Expected Output 6 5 4 3 2 1 Test Case 2 Input (stdin) 6 9 8 7 6 5 4 Expected Output ...

Avatar

Display the value given value using pointer

Display the given value and using pointer concept. Test Case 1 Input (stdin) 10 2 3 4 5 6 7 8 9 10 1 Expected Output 2 3 4 5 6 7 8 9 10 1 Test Case 2 Input (stdin) 7 2 4 8 12 14 ...

Avatar

Longest Consecutive 1s

Given a number N, Your task is to find the length of the longest consecutive 1s in its binary Test Case 1 Input (stdin) 1 14 Expected Output 3 Test Case 2 Input (stdin) 1 222 Expected Output 4 ...

Avatar

Longest Consecutive 1s

Given a number N, Your task is to find the length of the longest consecutive 1s in its binary Test Case 1 Input (stdin) 1 14 Expected Output 3 Test Case 2 Input (stdin) 1 222 Expected Output 4 ...

Avatar

Tweedle-Dee and Tweedle-Dum

Tweedle-Dee and Tweedle-Dum are in a fierce battle playing even-odd nim. This novel game is played on N heaps. Heap i contains ai stones. Like normal nim, Tweedle-Dee and Tweedle-Dum alternate taking a positive number of stones from any single one ...

Avatar

Tweedle-Dee and Tweedle-Dum

Tweedle-Dee and Tweedle-Dum are in a fierce battle playing even-odd nim. This novel game is played on N heaps. Heap i contains ai stones. Like normal nim, Tweedle-Dee and Tweedle-Dum alternate taking a positive number of stones from any single o ...

Avatar

Octal to decimal conversion

Java program to convert from octal to decimal number Test Case 1 Input (stdin) 10 Expected Output 8 Test Case 2 Input (stdin) 12 Expected Output 10 ...

Avatar

PATTERNS

Write a java program to display the following patterns Test Case 1 Input (stdin) 7 Expected Output 1 2 3 4 5 6 7 2 3 4 5 6 7 3 4 5 6 7 4 5 6 7 5 6 7 6 7 ...

Avatar

3 digit numbers

Design an algorithm to find out how many 3 digit(that is all numbers starting from 100 to N numbers are divisible by 6 in all. Test Case 1 Input (stdin) 1000 Expected Output 150 Test Case 2 Input (st ...

Avatar

The British and American Style of Spelling

American English and British English differ in several aspects which are reflected in their spelling. One difference frequently observed, is that words written in American English, which have a suffix ze often end in se in British English. Given the ...

Avatar

Union of two arrays maths

Given two arrays A and B, find union between these two array. If there are repetitions, then only one occurrence of element should be printed in union. Input: The first line of input contains an integer T denoting the number of test cases. Th ...

Avatar

ADJACENT DIGITS

Given a number, raise each digits with the adjacent digits as its powers and add them. Input Format: Give the number of any digits. Output Format: Raise the powers and add them. Explanation: For 146=> (14+46)=1+4096=4097 Test Case 1 Input ...

Avatar

Rotate Array by n elements

Given an array of size n, rotate it by d elements. Input: The first line of the input contains T denoting the number of testcases. First line of test case is the number of elements 'n' and elements 'd' to be rotated. Second line of test case will ...

Avatar

Ciel and A-B Problem

In Ciel's restaurant, a waiter is training. Since the waiter isn't good at arithmetic, sometimes he gives guests wrong change. Ciel gives him a simple problem. What is A-B (A minus B) ? Surprisingly, his answer is wrong. To be more precise, his an ...

Avatar

Euclid GCD Algorithm

Write a Program to Implement Euclid GCD Algorithm Test Case 1 Input (stdin) 257184 800128 Expected Output 28576 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Delicious Dishes

Chef is the owner of the loveliest restaurant in ChefTown. To make his work easier, all dishes are numbered by distinct positive integers, and you can order with this positive integer in Chefs restaurant. Amazingly Chef has many kinds of recipes, so ...

Avatar

Task for Alexey

Alexey is trying to develop a program for a very simple microcontroller. It makes readings from various sensors over time, and these readings must happen at specific regular times. Unfortunately, if two of these readings occur at the same time, t ...

Avatar

Sieve Of Eratosthenes

Write a Program to Implement Sieve Of Eratosthenes Test Case 1 Input (stdin) 500 Expected Output 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 ...

Avatar

Binary search

Write a Java program to implement binary search. Do a sorting then find the position of the element. Test Case 1 Input (stdin) 2 5 7 13 98 13 Expected Output Element found at position 4 Test Case 2 Input (stdin) 56 23 12 8 ...

Avatar

Sorting names

Write a java program for sorting a given list of names. Test Case 1 Input (stdin) Mouse Gerbil Hamster Expected Output Gerbil Hamster Mouse Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Swap method without using third variable

Write a java program to perform Swapping without using third variable Test Case 1 Input (stdin) 11 20 Expected Output Before Swapping a : 11 and b : 20 After Swapping a : 20 and b ...

Avatar

Set Max Value to Fibonacci Series

Write a java program to Set Max Value to Fibonacci Series Test Case 1 Input (stdin) 20 Expected Output 0 1 1 2 3 5 8 13 Test Case 2 Input (stdin) 45 Expected Output 0 1 1 2 3 5 8 ...

Avatar

Matrix addition

Write a java program to add two given matrices Test Case 1 Input (stdin) 1 2 3 4 1 2 3 4 Expected Output 2 4 6 8 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Matrix multiplication

Write a java program to multiply two given matrices. Test Case 1 Input (stdin) 1 1 1 1 1 1 1 1 1 1 1 1 Expected Output 3 3 3 3 Test Case 2 Input (stdin) ...

Avatar

Generate Fibonacci Series within a interval

Write a java program to Generate Fibonacci Series within a interval Test Case 1 Input (stdin) 11 100 Expected Output 11 12 23 35 58 93 Test Case 2 Input (std ...

Avatar

Indian Zodiac

The indian zodiac assigns animals to years in a 12 year cycle. One 12 year cycle is shown in the table below. The pattern repeats from there, with 2012 being another year of the dragon, and 1999 being another year of the hare. 2000 Dragon 2001 Snake ...

Avatar

Palindrome

Write a java program that checks whether a given string is a palindrome or not Test Case 1 Input (stdin) madam Expected Output palindrome Test Case 2 Input (stdin) won Expected Output not palindrome ...

Avatar

Display the user Address

Write a program to read the address of a user. Display the result by breaking it into multiple lines Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal pla ...

Avatar

Difference between two Factorials

Write a java program to find the Difference between two Factorial Test Case 1 Input (stdin) 5 4 Expected Output The Difference is : 96 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Assignment Operator

Sneha got a single integer as an input , and her task to perform all assignment operations in with the given input . Let us help her to solve with the following conditions met, To Perform , Assign an input the new the variable and display Usin ...

Avatar

STRING PERMUTATIONS

Java Program To Find All Permutations Of String Recursively Test Case 1 Input (stdin) JSP Expected Output JSP JPS SJP SPJ PJS PSJ Test Case 2 Input (stdin) AVM Expected Output AVM AMV VAM VMA MAV ...

Avatar

Richter Scale

The following table contains earthquake magnitude ranges on the Richter scale and their descriptors: Magnitude Descriptor Less than 2.0 Micro 2.0 to less than 3.0 Very minor 3.0 to less than 4.0 Minor 4.0 to less than 5.0 Light 5.0 to less ...

Avatar

Gap Filler Game

Chef is facing severe problems at his restaurant. Because his kitchen is small so only small number of cooks can fit in which results in slow service. Customers don't like waiting for their food. While he has already started looking for new place to ...

Avatar

RECTANGLE

Write a C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. Test Case 1 Input (stdin) 5 4 3 2 Expected Output 20 10 Test Case 2 Input (stdin) 5 10 4 6 Expected Output ...

Avatar

DISPLAY

Vasu has a home and like to display the length and breadth of the same (Hint: Class C1 gets length and breadth as input which is used by class C2 derived from C1. C2 displays it using a function) Test Case 1 Input (stdin) 20.0 30.0 Expected O ...

Avatar

RECTANGLE

Write a C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. Test Case 1 Input (stdin) 5 4 3 2 Expected Output 20 10 Test Case 2 Input (stdin) 5 10 4 6 Expected Output ...

Avatar

ROOT OF THE TREE

Chef has a binary tree. The binary tree consists of 1 or more nodes. Each node has a unique integer id. Each node has up to 2 children, which are identified by their ids, and each node is the child of at most 1 other node. A node X is considered to b ...

Avatar

String conversion

Write a java program to check if two strings are identical or not identical Test Case 1 Input (stdin) java sir Expected Output not identical Test Case 2 Input (stdin) sir ...

Avatar

Python Programming

...

Avatar

RECTANGLE

Write a C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. Test Case 1 Input (stdin) 5 4 3 2 Expected Output 20 10 Test Case 2 Input (stdin) 5 10 4 6 Expected Ou ...

Avatar

MULTIPLE INHERITENCE 1

Write a program that calculates the area and perimeter of an rectangle but, to perform this program, multiple inheritance is used. Test Case 1 Input (stdin) 5.1 2.3 Expected Output 11.73 14.80 Test Case 2 Input (stdin) 1.5 2. ...

Avatar

EXCEPTION HANDLING-Try catch

You will be given two integers X AND Y and as input, you have to compute . If X and Y are not 32 bit signed integers or if Y is zero, exception will occur and you have to report it. Read sample Input/Output to know what to report in case of exception ...

Avatar

Glass Measurement

Chef has n glasses each with a capacity of xi. There are Q+1 people playing a game including the Chef himself. Everyone at his/her turn gives a positive integer Mi and asks the Chef if volume M of water can be transferred using the n glasses with Ch ...

Avatar

Inheritance

Display the employee salary using the simple Inheritance Test Case 1 Input (stdin) 5000 Expected Output 5000 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

ByteIndianGoldCoins

In Byteland they have a very strange monetary system. Each Bytelandian gold coin has an integer number written on it. A coin n can be exchanged in a bank into three coins: n/2, n/3 and n/4. But these numbers are all rounded down (the banks have to ...

Avatar

single inheritance

Program which will accept name,age,height and weight from the user . It shows the output Test Case 1 Input (stdin) Hari 20 5.2 50 Expected Output Name:Hari Age:20 Height:5.2 Weight:50 Test Case 2 Input (stdin) Jai ...

Avatar

Swap

Write a Python Program to swap two numbers without using third Variable Test Case 1 Input (stdin) 10 20 Expected Output 20 10 Test Case 2 Input (stdin) 30 50 Expected Output 50 30 ...

Avatar

Sereja and Votes

Sereja conducted a voting about N of his opinions. Ai percent of people voted for opinion number i. This statistics is called valid if sum of all Ai is equal to 100. Now let us define rounding up of a statistics A. If Ai is not an integer, it w ...

Avatar

Three Idiots

Create a program that reads three integers from the user and displays them in sorted order (from smallest to largest). Use the min and max functions to find the smallest and largest values. The middle value can be found by computing the sum of ...

Avatar

Number Of Factors

Alice has learnt factorization recently. Bob doesn't think she has learnt it properly and hence he has decided to quiz her. Bob gives Alice a very large number and asks her to find out the number of factors of that number. To make it a little easier ...

Avatar

RECTANGLE

Write a C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. Test Case 1 Input (stdin) 5 4 3 2 Expected Output 20 10 Test Case 2 Input (stdin) 5 10 4 6 Expected Ou ...

Avatar

Get lowest and highest key of TreeMap

Get the lowest and highest key stored in the java TreeMap object of java TreeMap class. Test Case 1 Input (stdin) Expected Output Elements of TreeMap are{1=One, 2=Two, 3=Three, 4=Four, 5=Five} Lowest key Stored in Java TreeMap is : 1 ...

Avatar

Sum of the Series

Write a program to find sum of series Hint:1+2+3+4+n Test Case 1 Input (stdin) 18 Expected Output 171 Test Case 2 Input (stdin) 100 Expected Output 5050 ...

Avatar

Sereja and two strings

Sereja has a string A consisting of n lower case English letters. Sereja calls two strings X and Y each of length n similar if they can be made equal by applying the following operation at most once in each of them. Chose any two position i, ...

Avatar

Moving Between floors

Did you know that the world's tallest structure is Burj Khalifa in Dubai ? To survive when the world ends, Mr.Turing thinks that he should climb one of those skyscrapers ( tall buildings ). There are N tall buildings numbered b_1, b_2, ... , b_N in t ...

Avatar

Vowels

Implement the following algorithm 1. Take a string from the user and store it in a variable. 2. Initialize a count variable to 0. 3. Use a for loop to traverse through the characters in the string. 4. Use an if statement to check if the charact ...

Avatar

Flipping Coins

There are N coins kept on the table, numbered from 0 to N - 1. Initially, each coin is kept tails up. You have to perform two types of operations : 1) Flip all coins numbered between A and B inclusive. This is represented by the command "0 ...

Avatar

Iterate through a Collection

Iterate through a Collection using Java Iterator. Test Case 1 Input (stdin) Expected Output Elements of the ArrayList are 1 2 3 4 5 6 7 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Shape Form

Write a program that determines the name of a shape from its number of sides. Read the number of sides from the user and then report the appropriate name as part of a meaningful message. Your program should support shapes with anywhere from 7 up t ...

Avatar

Display It

Iterate through a Collection using Java Iterator. Test Case 1 Input (stdin) Expected Output Elements of the ArrayList are 1 2 3 4 5 6 7 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Addition of 3 Numbers

Meenu is learning to add numbers.If Abi gives three values,meenu need to add it and give the correct answer. Test Case 1 Input (stdin) 1 2 3 Expected Output 6 Test Case 2 Input (stdin) 10 20 30 Expected Output 60 ...

Avatar

Prime Generator-1

Write a program to find prime numbers between two range Input 1: Lower Range Input 2: Upper Range Output: List of prime numbers Refer sample input and output for formatting specification. Test Case 1 Input (stdin) 11 31 Expected ...

Avatar

Divide by Zero

Divide two numbers. Throw an exception if the denominator is 0 and display "EXCEPTION". If denominator is not 0, display "VALID". Test Case 1 Input (stdin) 10 0 Expected Output EXCEPTION Not possible Test Case 2 Input (stdin) 10 ...

Avatar

Multiplication Table

Write a python program to print the table of a given number Print the multiplication till 10. Test Case 1 Input (stdin) 7 Expected Output 7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 ...

Avatar

LCM of two numbers

Find the LCM of two given numbers Test Case 1 Input (stdin) 3 4 Expected Output 12 Test Case 2 Input (stdin) 6 5 Expected Output 30 ...

Avatar

eLab Temperature Scale

Write a program that begins by reading a temperature from the user in degreesCelsius. Then your program should display the equivalent temperature in degrees Fahrenheit. The calculations needed to convert between different units of temperature ...

Avatar

Multiplication Table

Write a program to print the multiplication table for the given Number Input 1:Positive number Output: Multiplication table of the corresponding number Refer sample input and output for formatting specification. Test Case 1 Input (stdin) ...

Avatar

Month Day and Year - Jan to May

The length of a month varies from 28 to 31 days. In this exercise you will create a program that reads the name of a month from the user as a string. Then your program should display the number of days in that month. Display 28 or 29 days for Fe ...

Avatar

Word Sort

Write a program to sort the words in the sentence in alphabetic order Input:A Sentence Output: Display the words of a sentence in sorted order Refer sample input and output for formatting specification. Test Case 1 Input (stdin) Hello t ...

Avatar

Multiplication Table

Write a program to print multiplication table as shown in the test cases Test Case 1 Input (stdin) 2 5 Expected Output 1 * 2 = 2 2 * 2 = 4 3 * 2 = 6 4 * 2 = 8 5 * 2 = 10 Test Case 2 Input (stdin) 5 6 Expected Outp ...

Avatar

Letter Grade Points

At a particular university, letter grades are mapped to grade points in the following manner: Letter Grade points A+ 4.0 A 4.0 A- 3.7 B+ 3.3 B 3.0 B- 2.7 C+ 2.3 C 2.0 C- 1.7 D+ 1.3 D 1.0 F 0 Write a program that begins by reading ...

Avatar

Help Raju First Game

Try the following example Ramu was given a game by his friend raj. When raj says a number then raj needs to tell that number. And when Raj says a word or character he has to remain silent. Kindly help Raju and Ramu to solve the task. Refer the sample ...

Avatar

LCM Check

Write a python function to calculate the LCM of numbers Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds to ...

Avatar

Number of Occurences of a Character

Write a program find the number of occurrences of a character in a given string. Input: First line is the string, s Second line is the character, c Output: An integer, i.e. the number of occurrences of c in s. Test Case 1 Input (stdin) we ...

Avatar

Pearl Game - Raju and Sharma

Raju and his friend Sharma decided to collect pearls from beach as their hobby. Sharma and Raju started collecting the pearls from the beach and stored it in the repository. Sharma was very happy as his friend Raju was doing it for so many days. ...

Avatar

Sum of digits

Write a c++ program to find the sum of digits of the given number Test Case 1 Input (stdin) 1234 Expected Output The sum is 10 Test Case 2 Input (stdin) 367 Expected Output The sum is 16 ...

Avatar

Seasoners

The year is divided into four seasons: spring, summer, fall and winter. While the exact dates that the seasons change vary a little bit from year to year because of the way that the calendar is constructed, we will use the following dates for this ex ...

Avatar

Number of Days!

Write a Program to Convert Days Into Years, Weeks and Days Test Case 1 Input (stdin) 365 Expected Output Years:1 Weeks:0 Days:0 Test Case 2 Input (stdin) 924 Expected Output Years:2 Weeks:27 Days:5 ...

Avatar

LCM of two numbers

Find the LCM of two given numbers Test Case 1 Input (stdin) 3 4 Expected Output 12 Test Case 2 Input (stdin) 6 5 Expected Output 30 ...

Avatar

Game of Digits

Develop a program that reads a four-digit integer from the user and displays the sum of the digits in the number. For example, if the user enters 3141 then your program should display 3+1+4+1=9. Test Case 1 Input (stdin) 9091972 Expected Ou ...

Avatar

Area

Calculate area of rectangle and triangle. Following diagram further explains the concept : Shape / \ Rectangle Triangle Test Case 1 Input (stdin) 5 6 Expected Output 30 15 Test Case 2 Input (stdin) 4 5 Expected Outp ...

Avatar

Noise Levels

The following table lists the sound level in decibels for several common noises. Noise Decibel level (dB) Jackhammer noise >=130 Gas lawnmower 106 to 129 Alarm clock 41 to 105 Quiet room 0 to 40 Write a program that reads a sound level in ...

Avatar

Help Raju First Game

Try the following example Ramu was given a game by his friend raj. When raj says a number then raj needs to tell that number. And when Raj says a word or character he has to remain silent. Kindly help Raju and Ramu to solve the task. Refer the sample ...

Avatar

Smallest Divisor

Write a program takes an integer and prints the smallest divisor of the integer Test Case 1 Input (stdin) 6 Expected Output Smallest divisor is: 2 Test Case 2 Input (stdin) 25 Expected Output Smallest divisor is: 5 ...

Avatar

Alexy and microcontroller frezee

Alexey is trying to develop a program for a very simple microcontroller. It makes readings from various sensors over time, and these readings must happen at specific regular times. Unfortunately, if two of these readings occur at the same time, the m ...

Avatar

Interset Rate

Write a program to find the simple interest rate. Input 1: Principle Input 2: Time Input 3:Rate Output: Display the Simple interest Refer sample input and output for formatting specification Test Case 1 Input (stdin) 20000 5 ...

Avatar

Number of Days!

Write a Program to Convert Days Into Years, Weeks and Days Test Case 1 Input (stdin) 365 Expected Output Years:1 Weeks:0 Days:0 Test Case 2 Input (stdin) 924 Expected Output Years:2 Weeks:27 Days:5 ...

Avatar

String reverse

Write a program to join and reverse a string. Test Case 1 Input (stdin) Programming Expected Output gnimmargorP Test Case 2 Input (stdin) HAPPY:) Expected Output ):YPPAH ...

Avatar

Negative Sum

Write a program to find the sum of negative numbers Input:Positive and negative numbers Output:Display Sum of negative numbers Refer sample input and output for formatting specification. Test Case 1 Input (stdin) 7 10 -10 -43 ...

Avatar

Area of Rectangle

Calculates the area of rectangle using single inheritance is used. Test Case 1 Input (stdin) 3 2 Expected Output 6 Test Case 2 Input (stdin) 10 20 Expected Output 200 ...

Avatar

FACTORS

The program finds the factors of a number, which means the other numbers which can divide the given number. Eg: 5 is divisible by 5 and 1 Test Case 1 Input (stdin) 6 Expected Output 1 2 3 6 Test Case 2 Input (stdin) 5 ...

Avatar

The length

Write a Program to find the length of the given string. Hint: Use len function Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input a ...

Avatar

Check the Functions

Write a program to check whether the given string contains the following: 1. input.isalpha() = check if all char in the string are alphabetic 2. input.isdigit() = test if string contains digits 3. input.istitle() = test if string contains title ...

Avatar

Who is least here

Write a Python program to count the number of lower-case letters in the entered string. Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to ...

Avatar

Sandwich Burger

Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken. CFK sells chicken chunks in small and large portions. A small portion contains 3 chunks; a large one 7 chunks. Ivan wants ...

Avatar

Game of Thrones - 2

Sharma was asked to perform a complex operation. His friend Monica will give two numbers to his friend sharma. Now sharma wants to club those numbers and provide her one final number. Refere sample input and output Input 1: 12 12 Output: 0 Input 2: - ...

Avatar

Hollow rectangular star pattern: (C++)

Number of rows: 3 Number of columns: 5 * * * * * * * * * * * * ...

Avatar

Adding Digits

Write a C++ Program to Add Digits of Number using pointer. Test Case 1 Input (stdin) 23 Expected Output The sum of the digits of 23 is 5 Test Case 2 Input (stdin) 6474 Expected Output The sum of the digits of 6474 is 21 ...

Avatar

POOL - CPPIOU004

You are planning to go for swimming classes. You would prefer to enroll in the center which has the swimming pool of a greater area. In the first centre that you visit, the swimming pool is a circular shape(radius-r). In the next centre that you visi ...

Avatar

Displaying output

Demonstrate a c program using function overloading that prints integer, float and character Test Case 1 Input (stdin) 10 25.057 c Expected Output The integer is 10 The float is 25.057 The character is c Test Case 2 Input (s ...

Avatar

Help Raj - Game 2

Try the following example. Ramu was given a game by his friend raj. When raj says a number then raj needs to tell that number. And when Raj says a word or character he has to remain silent. Kindly help Raju and Ramu to solve the task. Refer the sampl ...

Avatar

Fibonacci series

Write a c++ program to display the fibonacci series Test Case 1 Input (stdin) 5 Expected Output 0 1 1 2 3 Test Case 2 Input (stdin) 7 Expected Output 0 1 1 2 3 5 8 ...

Avatar

Ternary operator

write a program to find a number as positive or negative using ternary operator Test Case 1 Input (stdin) 5 Expected Output Number is positive Test Case 2 Input (stdin) -2 Expected Output Number is negative ...

Avatar

Aggregate Calculation

A company wants to calculate the aggregate of a student to decide whether he is eligible for the post.A student might be a class 10th or 12th passed out. If he is in class 10,input marks of 4 subjects. if he is is class 12,input marks of 3 subjects. ...

Avatar

stddevi

Calculate Standard Deviation using functions Test Case 1 Input (stdin) 1 2 3 4 5 6 7 8 9 10 Expected Output 2.87228 Test Case 2 Input (stdin) 11 21 13 4 5 6 7 8 9 10 Expected Ou ...

Avatar

Factorial using Recursion

Find the factorial of a given number using recursion Test Case 1 Input (stdin) 5 Expected Output 120 Test Case 2 Input (stdin) 3 Expected Output 6 ...

Avatar

Swapping two values

Write a program to swap the values of two variables. Test Case 1 Input (stdin) 5 2 Expected Output 2 5 Test Case 2 Input (stdin) 9 6 Expected Output 6 9 ...

Avatar

Translation

The translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (and pronounced) reversely. For ...

Avatar

Positive or not

Check the given number is a positive number or not Test Case 1 Input (stdin) 478 Expected Output YES Test Case 2 Input (stdin) -85 Expected Output NO ...

Avatar

User-Defined Exceptions

Two numbers are entered by user for division operation. If the dividend is zero, then division by zero will cause exception which is thrown into catch block. If the answer is less than 0, then exception "Division is less than 1" is thrown. All other ...

Avatar

Quotient & Remainder

Write a program to read 2 numbers & print Quotient & Remainder. Test Case 1 Input (stdin) 4 2 Expected Output 2 0 Test Case 2 Input (stdin) 50 100 Expected Output 0 50 ...

Avatar

Student Details

You have to create a class, named Student, representing the student's age (int), first_name (string), last_name (string), standard (int) and store the data of a student. Create setter and getter functions for each element; that is, the class should a ...

Avatar

CONCATENATE TWO STRINGS

Write a c++ program for Concatenate Two Strings without using strcat() function Test Case 1 Input (stdin) Kaveri river Expected Output Kaveririver Test Case 2 Input (stdin) Hello World Expected Output HelloWorld ...

Avatar

Day by Date

"Computation of the date either previous or forthcoming dates is quiet easy. But it is quiet difficult to calculate the day from a particular given date. You are required to find a day from a particular date given to you. Input It consists of a sin ...

Avatar

String copy

Write a program to find length of string by overloading = operator Test Case 1 Input (stdin) happy Expected Output Copied string is happy Test Case 2 Input (stdin) H:)appy Expected Output Copied string is H:)appy ...

Avatar

Area of square and circle

Write a program to find the area of square and circle with using pure virtual function Test Case 1 Input (stdin) 4 5 Expected Output Area of square: 16 Area of circle: 78.5 Test Case 2 Input (stdin) 7 4 Expected Output ...

Avatar

User defined Exception

Write a cpp program to Handle User defined Exceptions such as Divide by zero. Test Case 1 Input (stdin) 10 0 Expected Output Divide by zero exception Test Case 2 Input (stdin) 15 5 Expected Output 3 ...

Avatar

Control Statement 1

C++ program to display integer from 1 to n except 6 and 9. "n" is the input number Test Case 1 Input (stdin) 11 Expected Output 1 2 3 4 5 7 8 10 11 Test Case 2 Input (stdin) 10 Expected Output 1 2 3 4 5 7 8 10 ...

Avatar

Shapes

Vasu needs to find the area of different shapes. She created a base class which has multiple functions to calculate area for different shapes. While she created necessary functions like input(), output() to get input to be used by base class and di ...

Avatar

Swap numbers without using temporary variable

Swap the two given numbers without using temporary variable Test Case 1 Input (stdin) 10 20 Expected Output Before a=10 b=20 After a=20 b=10 Test Case 2 Input (stdin) 6 3 Expected Output Before a=6 b=3 After a=3 b=6 ...

Avatar

Cube of given number

Assume that the program has functions, one to calculate the cube of given integer and another to find the cube of given float number Test Case 1 Input (stdin) 2 3.5 Expected Output Cube is 8 Cube is 42.875 Test Case 2 Input (stdi ...

Avatar

Student Class

Write a class called 'student' with Data members: name(char type), marks1, marks2 (integer type) The program asks the user to enter name and marks. Then calc_median() calculates the median marks and disp() display name and total mark and median on sc ...

Avatar

Greatest of 2 numbers

Write a C++ program to get and display the greatest of two numbers Test Case 1 Input (stdin) 10 20 Expected Output The greatest number is 20 Test Case 2 Input (stdin) 25 15 Expected Output The greatest number is 25 ...

Avatar

Memory Management

Only the memory required to store num (entered by user) number of floating-point data is declared dynamically. Test Case 1 Input (stdin) 6 5.5 6.6 7.7 8.8 3.3 2.2 Expected Output Displaying GPA of students. Student1 :5 ...

Avatar

Merge Two Arrays

Following C++ program ask to the user to enter array 1 and 2 size, then ask to enter array 1 and 2 elements, to merge or add to form new array, then display the result of the added array or merged array (Here we display the direct merged array). Tes ...

Avatar

Waiting or Not Waiting

Raju maths teacher gave him a task of identifying the number name. If the number is greater than 0 then he should utter to the teacher as "I am waiting". If the number is less than 0 then he should utter the word as "I am not waiting". If the number ...

Avatar

Addition of Two Numbers using Nested Classes

Construct a class called outer representing a member x and a member function get() to read the value of x. Create another class inner inside the class outer with member y and the following member functions: get(): to read the value of x. sum(): ...

Avatar

BUZZ - CPPIOU005

In the standard version of the math game Buzz, players begin counting and whenever a player reaches a number that has seven as a digit or is divisible by seven, he says "Buzz" instead of the number. Numbers such as seventy require the player to say " ...

Avatar

Area

Write a class having two private variables and one member function which will return the area of the rectangle. Test Case 1 Input (stdin) 4 5 Expected Output 20 Test Case 2 Input (stdin) 6 7 Expected Output 42 ...

Avatar

Checking Valid Data

Check entered student mark is valid or not Test Case 1 Input (stdin) 125 Expected Output Invalid Mark Test Case 2 Input (stdin) -5 Expected Output Invalid Mark ...

Avatar

Sum of Two Numbers

Accept these two numbers from the user in base class and display the sum of these two numbers in derived class. C++ program to add two numbers using single inheritance Test Case 1 Input (stdin) 5 2 Expected Output 7 Test Case 2 Inpu ...

Avatar

Adding Numbers

am has newly joined in the XXX bank. He had stuck in tallying the accounts in the month end. Help him to tally the accounts by summing up the credits to the bank for that month Test Case 1 Input (stdin) 10 2 Expected Output 12 Test ...

Avatar

Hollow rectangular star pattern: (JAVA)

Number of rows: 3 Number of columns: 5 * * * * * * * * * * * * ...

Avatar

Check Vowel or a Consonant

Write a program to check whether given string is vowels or consonant Test Case 1 Input (stdin) i Expected Output i is a vowel Test Case 2 Input (stdin) H Expected Output H is a consonant ...

Avatar

Adding Numbers

Ram has newly joined in the XXX bank. He had stuck in tallying the accounts in the month end. Help him to tally the accounts by summing up the credits to the bank for that month Test Case 1 Input (stdin) 10 2 Expected Output 12 Tes ...

Avatar

Chat room

Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word s. It is considered that Vasya managed to say hello if several letters can be deleted from t ...

Avatar

Add two distance

To add two distances using binary plus (+) operator overloading program in c++. Test Case 1 Input (stdin) 20 10 30 15 Expected Output Feet:52 Inches:1 Test Case 2 Input (stdin) 22 10 23 11 Expected Output ...

Avatar

Floyds Triangle

Print Floyd's Triangle. 1 2 3 4 5 6 7 8 9 10 Test Case 1 Input (stdin) 4 Expected Output 1 2 3 4 5 6 7 8 9 10 Test Case 2 Input (stdin) 8 Expected Output 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 ...

Avatar

Chef And Operators

Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators. Relational Operators are operators which check relationship between two values. Given two numerical values A and B you need to help ...

Avatar

Method overloading

Using a class and required methods Overload the unary logical NOT(!) operator Test Case 1 Input (stdin) 4 Expected Output 4 0 Test Case 2 Input (stdin) 10 Expected Output 10 0 ...

Avatar

Merge Two Arrays

Following C++ program ask to the user to enter array 1 and 2 size, then ask to enter array 1 and 2 elements, to merge or add to form new array, then display the result of the added array or merged array (Here we display the direct merged array). Tes ...

Avatar

Sequence of values

Passing the value and manipulating by using the derived class have 3 classes every class inherits its immediate super class and display out as sequence of three classes Test Case 1 Input (stdin) 5 4.3 T Expected Output 54.3T Tes ...

Avatar

LCM

Write a program to find LCM Test Case 1 Input (stdin) 12 18 Expected Output LCM = 36 Test Case 2 Input (stdin) 20 60 Expected Output LCM = 60 ...

Avatar

Greatest of 3 numbers

Write a C++ program to get and display the greatest of three numbers Test Case 1 Input (stdin) 10 20 30 Expected Output The greatest number is 30 Test Case 2 Input (stdin) 15 10 5 Expected Output The greatest number ...

Avatar

Display

Vasu has a home and like to display the length and breadth of the same (Hint: Class C1 gets length and breadth as input which is used by class C2 derived from C1. C2 displays it using a function) Test Case 1 Input (stdin) 20 30 ...

Avatar

Addition of Distance objects

write a C++ program to add two distance objects using binary + operator Test Case 1 Input (stdin) 22 10 78 17 Expected Output Sum of Distance is: 102 Feet 3 Inches Test Case 2 Input (stdin) -5 10 45 -7 Expected Output S ...

Avatar

Largest integer value

Write a C++ program to find the max of an integral data set. The program will ask the user to input the number of data values in the set and each value. The program prints on screen a pointer that points to the max value. Test Case 1 Input (stdin ...

Avatar

Reverse of digits

Write a c++ program to find the reverse of digits of the given number Test Case 1 Input (stdin) 1234 Expected Output The reverse is 4321 Test Case 2 Input (stdin) 367 Expected Output The reverse is 763 ...

Avatar

Anastasia and pebbles

Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in the park. She has only two ...

Avatar

Course Selection

The marks obtained by a student in 4 different subjects are input by the user. The student gets a division as per the following rules: Percentage above or equal to 95 - Medical Course Percentage between 90 and 95 Engineering course Percentage betw ...

Avatar

DOLL SHOW

In london, every year during dasara there will be a very grand doll show. People try to invent new new dolls of different varieties. The best sold doll's creator will be awarded with cash prize. So people broke their head to create dolls innovatively ...

Avatar

Addition

C++ Program - Add Two Numbers using Pointer. Test Case 1 Input (stdin) 4 5 Expected Output 9 Test Case 2 Input (stdin) 67 33 Expected Output 100 ...

Avatar

Easy Acceptance

A very easy challenge. Write a program which accepts 3 integers and sort them in ascending order. For ex : 1) if user input 39 26 28 then output will be 26 28 39. 2) if user input 3934 2426 4628 then output will be 2426 3934 4628. Test Case 1 ...

Avatar

Pairwise AND sum

You are given a sequence of N integer numbers A. Calculate the sum of Ai AND Aj for all the pairs (i, j) where i < j. The AND operation is the Bitwise AND operation, defined as in here. Input: The first line of input consists of the integer N. ...

Avatar

SAMPLE 001

Write a program to calculate the total expenses. Quantity and price per item are input by the user and discount of 20% is offered if the expense is more than 10000. Test Case 1 Input (stdin) 50 1000 Expected Output Total Expense is Rs. ...

Avatar

Display the value given value using pointer

Display the given value and using pointer concept. Test Case 1 Input (stdin) 10 2 3 4 5 6 7 8 9 10 1 Expected Output 2 3 4 5 6 7 8 9 10 1 Test Case 2 Input (stdin) 7 2 4 8 12 14 18 20 Expected Output 2 4 8 12 14 18 ...

Avatar

Hollow rectangular star pattern: (C)

Number of rows: 3 Number of columns: 5 * * * * * * * * * * * * ...

Avatar

PATTERN / PRAYMID (C++)

Program to print solid and hollow rectangle star pattern is discussed here. Given the number of rows and columns, print the solid and hollow rectangle star patterns. Solid rectangular star pattern: Number of rows: 3 Number of columns: 5 ...

Avatar

Array Pointer 1

Get the input as an array and display the elements using pointer. Test Case 1 Input (stdin) 5 31 54 77 52 93 Expected Output 31 54 77 52 93 T ...

Avatar

Cascading

Use cascading/ multiple cin and cout in c ++ programming language to print values and messages together. Test Case 1 Input (stdin) 10 20 Expected Output 10 20 Test Case 2 Input (stdin) 50 100 Expected Output 50 100 ...

Avatar

Min Max Numbers

Write a program that reads from user a sequence of N integers and return min and max values. Input : 3 1 2 3 Output : min :1 max :3 Input : 4 0 2 9 -1 Output : min :-1 max :9 Test Case 1 Input (stdin) 3 1 2 3 Expec ...

Avatar

PLURAL

We need a simple function that determines if a plural is needed or not. It should take a number, and return true if a plural should be used with that number or false if not. This would be useful when printing out a string such as 5 minutes, 14 apples ...

Avatar

Average of Numbers

Your Task is to read some numbers from the user and print their average value (use arrays). Input : first line is the number of numbers user will enter (N) then, there are N-numbers as input Output : The Average value of these numbers Sam ...

Avatar

Mirror Problem

In london, every year during dasara there will be a very grand doll show. People try to invent new new dolls of different varieties. The best sold doll's creator will be awarded with cash prize. So people broke their head to create dolls innovatively ...

Avatar

PATTERN / PRAYMID (JAVA)

Program to print solid and hollow rectangle star pattern is discussed here. Given the number of rows and columns, print the solid and hollow rectangle star patterns. Solid rectangular star pattern:Number of rows: 3 Number of columns: 5 ...

Avatar

Minimum of two numbers

Write a program to find the maximum of two numbers of type integer and float using function overloading. Input: First line contains two integers. Second line contains two float values. Test Case 1 Input (stdin) 1 2 3.4 5.6 Expected Ou ...

Avatar

Year Calculation

As per the Calendar, the new year of the new millennium (Jan1st 2000) began on a saturday. Taking any year as input , write a program to display which day of the week shall the new year fall on . Input Input an Integer year Y such that 1800

Avatar

Prime or not

Write a C++ class called prime with Data members: Number integer, The program should ask for one integer number, and function check if it is prime or not Test Case 1 Input (stdin) 7 Expected Output Prime number Test Case 2 Input ...

Avatar

Increment and decrement

write a program to print the number in increment of two using ++ operator and -- operator Hint: a++ ++a a-- --a Test Case 1 Input (stdin) 1 Expected Output 1 3 3 1 Test Case 2 Input (stdin) 5 Expected Output ...

Avatar

Prime Number?

Check the given number is prime or not Test Case 1 Input (stdin) 9 Expected Output NO Test Case 2 Input (stdin) 7 Expected Output YES ...

Avatar

FIND VOWELS, CONSONANTS, DIGITS

Write a program which takes input as string and then implement the logic to find out Consonants, Digits, White spaces and Vowels in string Refer sample input and output: Input 1: SRM University 600203 Output 1: Vowels:4 Consonants:10 White ...

Avatar

Modulus of 2 numbers

Find the modulus of given two numbers Test Case 1 Input (stdin) 8 3 Expected Output 2 Test Case 2 Input (stdin) 5 6 Expected Output 5 ...

Avatar

ASCII Sum

Find the sum of all ascii values of characters of a given string Test Case 1 Input (stdin) abcde Expected Output 495 Test Case 2 Input (stdin) srm Expected Output 338 ...

Avatar

MAXIMUM OF N NUMBERS - CPPIOU006

Write a program to find the maximum of N numbers. Input :- First line contains "n" number of integer and the second line contains n integers Output :- maximum of entered elements Test Case 1 Input (stdin) 3 2 4 7 Expected Output 7 Te ...

Avatar

UpperCase conversion

Convert all the characters of a given string to upper case Test Case 1 Input (stdin) abcde Expected Output ABCDE Test Case 2 Input (stdin) sRm Expected Output SRM ...

Avatar

Greatest of three numbers (C++)

Find the greatest of the given three numbers Test Case 1 Input (stdin) 10 20 30 Expected Output 30 Test Case 2 Input (stdin) 8 5 9 Expected Output 9 ...

Avatar

SUM OF EVEN AND ODD NUMBERS

Write a program to find the sum of even and odd numbers in an array. Input Format: Input consists of n+1 integers. The first integer corresponds to n , the size of the array. The next n integers correspond to the elements in the array. Assume t ...

Avatar

Hollow rectangular star pattern: (Python)

Number of rows: 3 Number of columns: 5 * * * * * * * * * * * * ...

Avatar

Swap numbers using temporary variable

Swap the two given numbers using temporary variable Test Case 1 Input (stdin) 10 20 Expected Output Before a=10 b=20 After a=20 b=10 Test Case 2 Input (stdin) 6 3 Expected Output Before a=6 b=3 After a=3 ...

Avatar

Check Vowel or a Consonant

Write a program to check whether given string is vowels or consonant Test Case 1 Input (stdin) i Expected Output i is a vowel Test Case 2 Input (stdin) H Expected Output H is a consonant ...

Avatar

PUSH UPS WITH BLAZE

At UAB football games, Blaze does push ups after each Blazer score. After the first Blazer touchdown (and point after), Blaze does 7 push ups. After the second touchdown and point after, the score is now 14 and Blaze does 14 push ups. Write a prog ...

Avatar

Biased Chandan

Chandan is an extremely biased person, and he dislikes people who fail to solve all the problems in the interview he takes for hiring people. There are n people on a day who came to be interviewed by Chandan. Chandan rates every candidate from 0 to 1 ...

Avatar

Addition of 3 Numbers (C++)

Meenu is learning to add numbers.If Abi gives three values,meenu need to add it and give the correct answer. Test Case 1 Input (stdin) 1 2 3 Expected Output 6 Test Case 2 Input (stdin) 10 20 3 ...

Avatar

Shape Up

Write a program that determines the name of a shape from its number of sides. Read the number of sides from the user and then report the appropriate name as part of a meaningful message. Your program should support shapes with anywhere from 7 up ...

Avatar

LOWER TRIANGULAR MATRIX

A lower triangular matrix is a square matrix in which all the elements above the diagonal are zero. That is, all the non-zero elements are in the lower triangle: Write a C program to find whether a given matrix is a lower triangular matrix or n ...

Avatar

Pointers - 24

Write a function that accepts a string using pointers. In the function ,delete all the occurrences of a given character and display the modified string on the screen Input and Output Format: Refer sample input and output for formatting specific ...

Avatar

Parity

Ram and Sita playing the parity game. Two types of parity are there. One is odd parity and next is even parity. Ram will say the parity type, number of bits present in the message. Sita will find out the parity value and then she append the parity bi ...

Avatar

Tick Tick Tick

Hemas teacher give one assignment to him. she should write a code to find the time entered in hours, minutes and seconds into seconds. Help him to solve this task Test Case 1 Input (stdin) 2 30 4 Expected Output 9004 Test Case 2 Input ...

Avatar

Duplicate Removal

Program to Delete duplicate elements from an array Test Case 1 Input (stdin) 5 1 3 4 5 3 Expected Output 1 3 4 5 Test Case 2 Input (stdin) 3 1 3 3 Expected Output 1 3 ...

Avatar

Alternate

There is a machine in a lab which is working not properly. It displays the alternative elements in a set of input. The lab instructor asked the students to write a C Program for this scenario. i.e. to Print the Alternate Elements in an Array Test Ca ...

Avatar

SADNESS OF ARRAY

The sadness of an element in an array is defined as the minimum distance between itself and another element whose value is the same as this element. If there is no other element with the same value, its sadness is -1. Given an array of size N, fin ...

Avatar

W String

Kira likes to play with strings very much. Moreover he likes the shape of W very much. He takes a string and try to make a W shape out of it such that each angular point is a # character and each sides has same characters. He calls them W strings. ...

Avatar

Tsunami indonesia

In Indonesia, there was a very huge tsunami Millions and millions worth building and properties were destroyed. Many people lost their lives. Most of them were injured and few we're safe. He wanted to publish the newspaper and ask the counties to hel ...

Avatar

IO 3

Write a program to calculate the perimeter of a triangle using Heros formula Use the Following Formula: s = (a+b+c)/2 area = sqrt(s*(s-a)*(s-b)*(s-c)) Input and Output Format: Refer sample input and output for formatting specification. ...

Avatar

Consecutive String Copy

Write a program that will copy m consecutive characters from a string s1 beginning at position n into another string s2 Refer sample Input and Output: 1. The first input corresponds to the string input 2. The Second Input corresponds to the numb ...

Avatar

Compare 2 arrays

Write a program to find whether 2 arrays are the same. Input Format: Input consists of 2n+1 integers. The first integer corresponds to "n" , the size of the array. The next "n" integers correspond to the elements in the first array. The next "n ...

Avatar

Conversion Code -02

Write a C program to convert uppercase string to lowercase using inbuilt string library function strlwr(). How to use strlwr library function in C programming. Internally characters in C are represented as an integer value known as ASCII value. Which ...

Avatar

PLURAL

We need a simple function that determines if a plural is needed or not. It should take a number, and return true if a plural should be used with that number or false if not. This would be useful when printing out a string such as 5 minutes, 14 apples ...

Avatar

Maximum Frequency

How to find highest frequency character in a string using loop in C programming.Find frequency of each characters in the string and store it in some array of integers. Find maximum element in the array. Maximum element in the array will the be maxim ...

Avatar

DIGIT SEPARATION

Tom has a homework.His class teacher gave homework in Extract digits from integer in c language.your task is to help tom in extracting it by giving integer number as an input.the output should contain the extracted digits separated by a space. ...

Avatar

Array Deletion

Write a program to delete an element from the array. Input and Output Format: Assume that the maximum number of elements in the array is 20. Refer sample input and output for formatting specifications. All text in bold corresponds to inpu ...

Avatar

NUMBER OF VOWELS AND CONSTANT

Count vowels and constants in a given string using pointers Test Case 1 Input (stdin) welcome Expected Output 3 4 Test Case 2 Input (stdin) hello Expected Output 2 3 ...

Avatar

Substrings Palindromic

Chef likes strings a lot but he likes palindromic strings more. Today, Chef has two strings A and B, each consisting of lower case alphabets. Chef is eager to know whether it is possible to choose some non empty strings s1 and s2 where s1 is a sub ...

Avatar

Structures - 2 College Details

Create a structure called College. struct College { char name[100]; char city[100]; int establishmentYear; float passPercentage; } The structure variable name "S1" Write a program to get the details of n colleges and to display their d ...

Avatar

Catch the Second..

A bag contains set of integers and it is discovered by Ram. There is sheet in that bag. The person who found the bag should find the second largest number from the set of numbers. If the rightly found the will get a gold.. If you wish get the prize y ...

Avatar

Sticks

Chef and his little brother are playing with sticks. They have total N sticks. Length of i-th stick is Ai. Chef asks his brother to choose any four sticks and to make a rectangle with those sticks its sides. Chef warns his brother to not to break any ...

Avatar

Function pointer

Write a program in C to show how a function returning pointer using greater of two numbers Test Case 1 Input (stdin) 9 8 Expected Output The number 9 is larger Test Case 2 Input (stdin) -1 -8 Expected Output The number -1 is lar ...

Avatar

Sum of array elements using Functions

Write a C program to find the sum of the elements in an array. Input Format: Input consists of n+1 integers. The first integer corresponds to n , the size of the array. The next n integers correspond to the elements in the array. Assume that th ...

Avatar

Print 5 Sum of Positive Numbers

Write a C program to find allow the user to enter n number and finds the number of positive numbers entered and the sum of all positive numbers entered using a while loop Input format: Input consists of n+1 integers. The first integer correspon ...

Avatar

Print Index

How to find all occurrences of a character in a given string using for loop in C programming. Program to print all index of a character in a given string. Test Case 1 Input (stdin) u srmuniversity Expected Output u is found at index ...

Avatar

SUM OF DIGITS

Jagan played maths game with his friend sanjay to find sum of digits of the number he said. Help to jagan and sanjay to solve it by your code using union. Input Method Integer ranges from 1 to 999 Output Method sum of digits of the numbe ...

Avatar

SEQUENCE / Teenas Day

Teenu has a sequence of N numbers. He like a sequence better if the sequence contains his favorite sequence as a substring. Given the sequence and his favorite sequence(F) check whether the favorite sequence is contained in the sequence Input ...

Avatar

TRI-HEXAGONAL PUZZLE

"Little Johnny wants to play with his friends today. But his babysitter won't let him go! After a lot of begging, the heartless nanny gives him her brand new electronic puzzle and says: ""If you solve the puzzle then you are free to go"". Not being a ...

Avatar

BOTTLE DEPOSIT

In many jurisdictions a small deposit is added to drink containers to encourage people to recycle them. In one particular jurisdiction, drink containers holding one litre or less have a 0.10 deposit, and drink containers holding more than one litre h ...

Avatar

Pointers 5

Write a program to find Largest of three integer values using pointers Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corre ...

Avatar

Game of Strings

Harsh and Akshara are playing the Game of Strings. This game is a simple one and is played as a team. Both the players of a team will be given a string respectively. At the end of this game, every team is required find out the length of the longest s ...

Avatar

Student Management Systems

1. In this program, create a structure, "student" 2. The structure has three members: name (string), roll (integer) and marks (float). Then, a structure variable "s" is created to store information and display it on the screen. 3. Input the ...

Avatar

BITWISE OPERATOR

Kernel had an idea to use bitwise operator. He tries to do some multiplication operation. So he select a nu mber that should be multiplied by 4. His task is to write a c program to multiply given number by 4 using bitwise operators Test Case 1 I ...

Avatar

Find Mode

Write a program to find the mode of a given list of integers. Mode of a number is defined as the number which is most frequently occurred. For example: L = {1,2,2,3} // Here mode is 2(most frequently occurred) It is possible that multiple an ...

Avatar

Devu and friendship testing

Devu has n weird friends. Its his birthday today, so they thought that this is the best occasion for testing their friendship with him. They put up conditions before Devu that they will break the friendship unless he gives them a grand party on their ...

Avatar

CATCH THE SECOND

A bag contains set of integers and it is discovered by Ram. There is sheet in that bag. The person who found the bag should find the second largest number from the set of numbers. If the rightly found the will get a gold.. If you wish get the prize ...

Avatar

IO-8

Write a program to find the largest of three numbers using ternary operator Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold ...

Avatar

SECOND LARGEST

Three numbers A, B and C are the inputs. Write a program to find second largest among three numbers. The first line contains an integer T, total number of testcases. Then follow T lines, each line contains three integers A, B and C. Display the secon ...

Avatar

CATCH THE SECOND

A bag contains set of integers and it is discovered by Ram. There is sheet in that bag. The person who found the bag should find the second largest number from the set of numbers. If the rightly found the will get a gold.. If you wish get the prize y ...

Avatar

IO 8

Write a program to find the largest of three numbers using ternary operator Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold ...

Avatar

CATCH THE SECOND

A bag contains set of integers and it is discovered by Ram. There is sheet in that bag. The person who found the bag should find the second largest number from the set of numbers. If the rightly found the will get a gold.. If you wish get the prize y ...

Avatar

GETTING BITS

Divya ask Devi to write a program to get minimum number of bits to store an integer number. Devi thinks a lot but she could not able to do this.Can you help her to derive a solution for this? Test Case 1 Input (stdin) 127 Expected Output ...

Avatar

SUBSEQUENCE / LONGEST WEIRD SUBSEQUENCE

"Finding the longest increasing subsequence is an old and well-known problem now. Here you will have to do something similar. You need to find the longest weird subsequence (LWS) of the given string. The subsequence is called weird if it can be spl ...

Avatar

Recursion 8 : Maximum Element in Array

Write a program to find the maximum element in an array using recursion. Input and Output Format: Input consists of n+1 integers. Refer sample input and output for formatting specifications. All text in bold corresponds to input and the ...

Avatar

REPLACE 1ST OCCURRENCE OF STRING

How to replace first occurrence of a character with another character in a string using loop in C programming. Input: 1. The String character 2. The Character that needs to be replaced in the given string 3. The Character to be replaced in t ...

Avatar

Code for Sort given string in ascending order

Test Case 1 Input (stdin) sample Expected Output aelmps Test Case 2 Input (stdin) string Expected Output ginrst ...

Avatar

Write a C program to search all occurrences of a word in given string using loop Array Index starts from 0

Test Case 1 Input (stdin) srm university srm university srm Expected Output 0 15 Test Case 2 Input (stdin) srm srm srm srm srm srm Expected Output 0 4 8 12 16 ...

Avatar

STRING FACTOR

The success of IEEE code-quest depends on number of times the factor is present in a given string.Help core members to find them Factor of string is defined as a substring.In this case it's '01'. Input First line of input contains an integer T, de ...

Avatar

COLOURED ARRAY

"Chef had a hard time arguing with his friend, and after getting a great old kick Chef saw a colored array with N cells, numbered from 1 to N. Explanation: For this sample, we can repaint only once, since K = 1. We should repaint 4th cell with color ...

Avatar

LARGE ARRAY

Read in "n" integer numbers into an array and find the average of two largest given numbers without sorting the array. The program should output the given the average Test Case 1 Input (stdin) 4 80 23 79 58 Expected Output First La ...

Avatar

BALLOTS

An election is contested by 5 candidates. The candidates are numbered 1 to 5 and the voting is done by marking the candidate number on the ballot paper. Write a program to read the ballots and count the votes cast for each candidate using an array ...

Avatar

BUS TICKETS

Every day, Mike goes to his job by a bus, where he buys a ticket. On the ticket, there is a letter-code that can be represented as a string of upper-case Latin letters. Mike believes that the day will be successful in case exactly two different le ...

Avatar

MIKES WORK

Every day, Mike goes to his job by a bus, where he buys a ticket. On the ticket, there is a letter-code that can be represented as a string of upper-case Latin letters. Mike believes that the day will be successful in case exactly two different le ...

Avatar

SWAPPING

Your task is to write a code to swapping of two numbers Input: Input should contain the value of the limit n Output: It should print the Sum of series upto n limit Test Case 1 Input (stdin) 12 89 Expected Output 89 12 Test Case ...

Avatar

PRINT SERIES

Vishu has a task to solve the following series. Write a C code to find the print 1+(1+2)+ (1+2+3)+ (1+2+3+4)++n. It will help him to come out of this problem. Input: Input should contain the value of the limit n Output: It should print the abov ...

Avatar

Sections

If the number of seats allowed to a particular branch in engineering exceeds 60, then where will be multiple sections in that branch. Given the number of seats allotted to a branch write a C program to determine whether there will be a single sect ...

Avatar

Doll Show

In London, Every year during Dasara there will be a very grand doll show. People try to invent new new dolls of different varieties. The best sold dolls creator will be awarded with cash prize . So people broke their head to create dolls innovatively ...

Avatar

Binary from decimal

Lydia learn number conversion concept in C. Her teacher gave a homework to convert the number from decimal to binary. Help her to convert the number from decimal to binary. Input should be from 0 to 127 64 32 16 8 4 2 1 Test Case 1 Input ( ...

Avatar

Chef And Operators

"Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators. Relational Operators are operators which check relatioship between two values. Given two numerical values A and B you need to help ...

Avatar

ABABAABA

You are given a uniformly randomly generated string S, consisting of letters from the set {""A"", ""B""}. Your task is to find a string T that appears in S as a subsequence exactly twice. In other words, you need to find such a string T, that there ...

Avatar

ABABAABA

You are given a uniformly randomly generated string S, consisting of letters from the set {""A"", ""B""}. Your task is to find a string T that appears in S as a subsequence exactly twice. In other words, you need to find such a string T, that there ...

Avatar

Find Mode

Write a program to find the mode of a given list of integers. Mode of a number is defined as the number which is most frequently occurred. For example: L = {1,2,2,3} // Here mode is 2(most frequently occurred) It is possible that multiple an ...

Avatar

Little Elephant and Balloons

The Little Elephant from the Zoo of Lviv is going to the Birthday Party of the Big Hippo tomorrow. Now he wants to prepare a gift for the Big Hippo. He has N balloons, numbered from 1 to N. The i-th balloon has the color Ci and it costs Pi dollars ...

Avatar

Prime words

In the magic land of Mathtopia, the words of the language are written only using two symbols: ones and zeros. A given word w is called "prime" if it cannot be written in the form of the concatenation of several copies of some shorter word. So, for ...

Avatar

Maximum Element in an Array using Functions

Write a program to find the maximum element in an array. Input Format: Input consists of n+1 integers. The first integer corresponds to n , the size of the array. The next n integers correspond to the elements in the array. Assume that the max ...

Avatar

MONTHS

Write a C program that accepts an integer as input and displays the corresponding month in words. [ January, February, March, April, May, June, July, August, September, October, November, December]. Use Switch statement. Input Format: ...

Avatar

Pointer - 7

Write a program to input 10 values in an array. Categorize each value as positive ,negative or equal to zero using pointer. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed c ...

Avatar

Deleting Vowels

Vowels includes only five letter that give great trouble to us. They are mingled with other letters in a string. Shanthi has a task to filter vowels from that string. Help her to do this task. Test Case 1 Input (stdin) hai Expected Output ...

Avatar

Fees Calculator

Write a program that displays the fees that a student needs to pay at the end of the semester. Use switch statement. Input Format: The first line of the input consists of a character from the set {A, B, C, D}. A corresponds to a day scholar stu ...

Avatar

Case Count

C PROGRAM TO COUNT NUMBER OF UPPERCASE AND LOWERCASE LETTERS FROM A SENTENCE Test Case 1 Input (stdin) Arun IS a GooD Expected Output Uppercase Letters=5 Lowercase Letters=6 Test Case 2 Input (stdin) HELLO SRM ...

Avatar

FUNCTIONS - ARRAY TYPE

Write a program to find the type of the array using functions. An array is said to be Even if all the elements in the array are even. An array is said to be Odd if all the elements in the array are odd. An array is said to be Mixed if it c ...

Avatar

IO 31

Pranav intelligent in playing riddle with numbers so, he gave his sister a puzzle to solve in which she need to solve by adding the left side integral part of two decimal numbers. Explanation: Raju gave his sister two decimal numbers : 23.44 an ...

Avatar

Xavier Math

Finding series is a difficult task in Maths. Xavier is given a homework to obtain the sum value for the following series. Your task is to write a code to find the sum of the following series 1 + 2 + . + n Input: Input should contain the val ...

Avatar

Big Hippo / Little Elephant and Balloons

The Little Elephant from the Zoo of Lviv is going to the Birthday Party of the Big Hippo tomorrow. Now he wants to prepare a gift for the Big Hippo. He has N balloons, numbered from 1 to N. The i-th balloon has the color Ci and it costs Pi dollars. ...

Avatar

LETTERS CYCLIC SHIFT

"You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' 'y' 'x' 'b' 'a' 'z'. In other words, each character is replaced with the previous charact ...

Avatar

ASCII code

Write a C program to generate ASCII code for a given character. Test Case 1 Input (stdin) C Expected Output 67 Test Case 2 Input (stdin) Z Expected Output 90 ...

Avatar

ABABAABA

You are given a uniformly randomly generated string S, consisting of letters from the set {""A"", ""B""}. Your task is to find a string T that appears in S as a subsequence exactly twice. In other words, you need to find such a string T, that there ...

Avatar

Ciel and A-B

"In Ciel's restaurant, a waiter is training. Since the waiter isn't good at arithmetic, sometimes he gives guests wrong change. Ciel gives him a simple problem. What is A-B (A minus B) ? Surprisingly, his answer is wrong. To be more precise, his ans ...

Avatar

Turbo Task

A task is given to 3 persons to complete it within a particular time. If the person exceeds the time limit he will be disqualified. Only those who complete it within the given time limit is qualified. Among the qualified persons, the person who compl ...

Avatar

Recursion 6 : GCD and LCM of 2 Numbers

Write a program to compute GCD and LCM of 2 numbers using recursion. Input and Output Format: Input consists of 2 integers. Refer sample input and output for formatting specifications. All text in bold corresponds to input and the res ...

Avatar

Continuous Sum

Chintu is confusing himself with series of numbers. He has to find the sum of the following series. Your task is to write a code to find the sum of the following series 1+(1+2)+ (1+2+3)+ (1+2+3+4)++n Input: Input should contain the value of the li ...

Avatar

Minimum and Maximum

" Chef loves to play with arrays by himself. Today, he has an array A consisting of N distinct integers. He wants to perform the following operation on his array A. Select a pair of adjacent integers and remove the larger one of these two. This decre ...

Avatar

Print its elements in reverse order

Using pointers to read in an array of integers and print its elements in reverse order. Test Case 1 Input (stdin) 5 11 22 33 44 55 Expected Output 55 44 33 22 11 Test Case 2 Input (stdin) 7 98 78 98 54 52 10 78 Expected Outp ...

Avatar

Pointer - 4

Write a program to convert floating point values into its integral equivalent using pointer Input and Output Format: All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds t ...

Avatar

Searching an Array

Write a C program to search for an element ‘a’ in the array. (Linear Search) Input Format: Input consists of n+2 integers. The first integer corresponds to ‘n’ , the size of the array. The next ‘n’ integers correspond to the ele ...

Avatar

In/out

Ms.Kirthiga, the faculty handling programming lab for you is very strict. Your seniors have told you that she will not allow you to enter the weeks lab if you have not completed atleast half the number of problems given last week. Many of you didnt u ...

Avatar

Minimum Element in an Array

Input Format: Input consists of n+1 integers. The first integer corresponds to ‘n’ , the size of the array. The next ‘n’ integers correspond to the elements in the array. Assume that the maximum value of n is 15. Output Format: R ...

Avatar

square sum

"Everyone knows what a square looks like. Mathematically, a square is a regular quadrilateral. This means that it has four equal sides and four equal angles (90 degree angles). One beautiful day, Johnny eagerly examined the interesting properties ...

Avatar

Back 2 Back

Rand has a task to find the sum of first and last digit of number upto given n numbers.Help him in writing C code to enter any number and find the sum of first and last digit of the number using for loop. Test Case 1 Input (stdin) 1234 E ...

Avatar

Mirror Image / Reverse Palindrome

Puck, the trickster, has again started troubling people in your city. The people have turned on to you for getting rid of Puck. Puck presents to you a number consisting of numbers from 0 to 9 characters. He wants you to reverse it from the fi ...

Avatar

SUM OF 6 NUMBERS

Print the sum of 6 numbers using array and pointers Test Case 1 Input (stdin) 1 2 3 4 5 6 Expected Output 21 Test Case 2 Input (stdin) 1 1 1 2 2 2 Expected Output 9 ...

Avatar

Pointers 6

Write a program to input a character and Categorize it as a vowel and consonant Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in b ...

Avatar

Case Count

C PROGRAM TO COUNT NUMBER OF UPPERCASE AND LOWERCASE LETTERS FROM A SENTENCE Test Case 1 Input (stdin) Arun IS a GooD$ Expected Output Uppercase Letters=5 Lowercase Letters=6 Test Case 2 Input (stdin) HELLO SRMM CHENN$ Ex ...

Avatar

Square Matrix

Given a square matrix of size NN, calculate the absolute difference between the sums of its diagonals. Input The first line contains a single integer N. The next N lines denote the matrix's rows, with each line containing N space-separated integ ...

Avatar

Pattern

Print the following pattern : If N = 1 1 If N = 2 2 2 2 2 1 2 2 2 2 If N = 3 3 3 3 3 3 3 2 2 2 3 3 2 1 2 3 3 2 2 2 3 3 3 3 3 3 and so on. Test Case 1 Input (stdin) 3 Expected Output 3 3 3 3 3 3 2 2 2 3 ...

Avatar

IO 10

...

Avatar

Sum of positive numbers- CARR035

Write a program to find the sum of positive numbers in an array. Input Format: Input consists of n+1 integers. The first integer corresponds to n , the size of the array. The next n integers correspond to the elements in the array. Assume that th ...

Avatar

Relational Operator

Get two values as input and print the the equal to not equal to operator according to the input. Test Case 1 Input (stdin) 5 5 Expected Output equal Test Case 2 Input (stdin) 3 6 Expected Output not equal ...

Avatar

TRIANGULAR NUMBERS

"A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the number of dots in a triangle ...

Avatar

Scanning Int and string by retailer

Haris retail shop he need a software to get the name of the product and cost of the product and generate a bill for that one product which consist of name of the product and cost of that product. Test Case 1 Input (stdin) soap 121 Expect ...

Avatar

Polygon

A convex polygon is a simple polygon whose interior is a convex set. The following properties of a simple polygon are all equivalent to convexity: - Every internal angle is less than 180 degrees. - Every line segment between two vertices remains in ...

Avatar

MIRROR PROBLEM

Puck, the trickster, has again started troubling people in your city. The people have turned on to you for getting rid of Puck. Puck presents to you a number consisting of numbers from 0 to 9 characters. He wants you to count the numbers that ...

Avatar

ID and SHIP

Write a program that takes in a letter class ID of a ship and display the equivalent string class description of the given ID. Use the table below. Class ID Ship Class B or b BattleShip C or c Cruiser D or d Destroyer F or f Frigate Test Case ...

Avatar

Mid Sum

"Sum all the numbers of the array except the highest and the lowest element (the value, not the index!). (The highest/lowest element is respectively only one element at each edge, even if there are more than one with the same value!) Example: ...

Avatar

Magical game of sum

Yesterday, puppy Tuzik learned a magically efficient method to find the sum of the integers from 1 to N. He denotes it as sum(N). But today, as a true explorer, he defined his own new function: sum(D, N), which means the operation sum applied D times ...

Avatar

RADIUS OF THE CIRCLE

Madhan is handling mathematics to 8th grade. He taught area and perimeter of geometric shapes to his students. He thought to give a test based on triangle and circles.The task is to calculate radius of the circle that is inscribed in triangle given t ...

Avatar

Basic programming in C

C programming is a stepping stone for many programmers in the programming world. C is best to learn internals of programming and know how a computer program works internally. Since it is close to low level programming. Programming in C can be a ni ...

Avatar

Basic programming in C

C programming is a stepping stone for many programmers in the programming world. C is best to learn internals of programming and know how a computer program works internally. Since it is close to low level programming. Programming in C can be a ni ...

Avatar

Pool

You are planning to go for swimming classes. You would prefer to enroll in the center which has the swimming pool of a greater area. In the first centre that you visit, the swimming pool is a circular shape(radius-r). In the next centre that you vi ...

Avatar

Square of a Number

Write a C program to find the square of a number Test Case 1 Input (stdin) 2 Expected Output 4 Test Case 2 Input (stdin) 5 Expected Output 25 ...

Avatar

Printing Alphabets

Remove Characters in the given String Except Alphabets Test Case 1 Input (stdin) t28lkj Expected Output tlkj Test Case 2 Input (stdin) p2r66o@gram84iz./@@@@@@@@@@@ Expected Output programiz ...

Avatar

Trip

You are starting out on a long (really long) trip. On the way, there are N gas stations, the locations of which are given as a1,a2,…,aN. Initially you are located at the gas station at a1, and your destination is at location a_N. Your car can only ...

Avatar

Length of the String

Program which will accept string from the user and find the length of the string Test Case 1 Input (stdin) welcome Expected Output 7 Test Case 2 Input (stdin) input Expected Output 5 ...

Avatar

Half pyramid

Sam had a program for a full pyramid. But he didnt know that how to print half pyramid by using alphabets. So help him to write a program to print half pyramid using alphabets using increment operator Test Case 1 Input (stdin) G Expected Outp ...

Avatar

Good Joke!

Vadim and Roman like discussing challenging problems with each other. One day Vadim told his friend following problem: Given N points on a plane. Each point p is defined by it's two integer coordinates — px and py. The distance between points a ...

Avatar

SADNESS OF ARRAY

The sadness of an element in an array is defined as the minimum distance between itself and another element whose value is the same as this element. If there is no other element with the same value, its sadness is -1. Given an array of size N, fin ...

Avatar

Sorting

Alice uses the following pseudocode when she needs to sort a permutation of Npositive integers: procedure Sort(list A) defined as: list less, greater if length(A) <= 1 then return A pivot := A(length(A)+1) / 2 for i := 1 ...

Avatar

Pogo Stick Jump

Raju lives in a colony. On his 9th birthday, his father gift him a Pogo Stick. He is so excited to play with pogo stick. The pogo stick moves one unit per jump. He wanders around his house jumping with pogo sticks. He wants to show the pogo ...

Avatar

Chef And his Cake

Chef’s girlfriend's birthday is near, so he wants to surprise her by making a special cake for her. Chef knows that his girlfriend likes cherries on the cake, so he puts cherries on the top of the cake, but he was not satisfied. Therefore, he decid ...

Avatar

Occurrence

There was a group of elements in which there may be repeated elements. So there was a task to find occurrence of an element in one dimensional array. Write a C program for this scenario Test Case 1 Input (stdin) 6 10 20 30 10 50 60 10 ...

Avatar

ADDING TWO DISTANCES

1. Create a Structure called "Distance" 2. Create two data members of "Distance Structure" feet(int), inch(float) 3. Create three structure variables as d1, d2 and sumOfDistances 4. Get two distances and add the feet and inches. Mandatory: ...

Avatar

IO 4

Given two cities at geographic coordinates (xA,yA) and (xB,yB), and calculate the distance between from city A to city B? Note: Use the distance between points formula dist=sqrt(pow((x2-x1),2)+pow((y2-y1),2)) Input and Output Format: Refe ...

Avatar

Take a count

Sheela gave a number to Jonnes and ask him to count the number of digits in a number. Sheela tries one simple logic to do that. So she decided to apply this concept in C. Test Case 1 Input (stdin) 3452 Expected Output ...

Avatar

Compatible Arrays using Functions

Two arrays are said to be compatible if they are of the same size and if the ith element in the first array is greater than or equal to the ith element in the second array for all i.Write a program to find whether 2 arrays are compatible or not. I ...

Avatar

Remove Alphabets

...

Avatar

SUM OF 6 NUMBERS

Print the sum of 6 numbers using array and pointers Test Case 1 Input (stdin) 1 2 3 4 5 6 Expected Output 21 Test Case 2 Input (stdin) 1 1 1 2 2 2 Expected Output 9 ...

Avatar

THREE MARKS

Mani Working as a professor in ABC college, have to get students three subjects points. so he planned to do one program to implement structure concept. Input 3 3 5 Output 3 3 5 ...

Avatar

WHERE ARE THE MARKS?

Ganapathy working as a professor in ABC college, have to get students three subjects points. so he planned to do one program to implement structure concept. Input 3 3 5 Output 3 3 5 Test Case 1 Input (stdin) 3 3 5 Expected ...

Avatar

Alphabet Game

Not everyone probably knows that Chef has younder brother Jeff. Currently Jeff learns to read. He knows some subset of the letter of Latin alphabet. In order to help Jeff to study, Chef gave him a book with the text consisting of N words. Jeff can ...

Avatar

Average Scale

A grocer has a sale of Rs. s1, Rs. s2, Rs. s3, Rs. s4 and Rs. s5 for 5 consecutive months. How much sale must he have in the sixth month so that he gets an average sale of Rs. x? Write a C program to compute the sale in the 6th month. Input ...

Avatar

Little Elephant and Movies

Little Elephant from Zoo of Lviv likes to watch movies. There are N different movies (numbered from 0 to N 1) he wants to watch in some order. Of course, he will watch each movie exactly once. The priority of ith movie is Pi. ...

Avatar

Functions-Lucky String

Write a program to find whether the given string is Lucky or not. A string is said to be lucky if the sum of the ascii values of the characters in the string is even. Refer function specifications for the function details. The function a ...

Avatar

Recursion 3 : Compute a^n

Write a program to compute a^n (a power n) using recursion. Input and Output Format: Input consists of 2 integers. Refer sample input and output for formatting specifications. All text in bold corresponds to input and the rest correspon ...

Avatar

Palindrome

Teacher gave homework to the students that their task is to find a stirng which should remains the same even when we reverse it. Paul was interested in finding such string. Help paul by writing a code to find whether the given string is palindrome or ...

Avatar

Mahasena.

"Kattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (as army-chief), and the reason for that was their really powerful army, also called as Mahasena. Kattapa was known ...

Avatar

Matrix Again

"In every contest there should be an easy problem about matrices. December Cook-Off is not an exception. Given a matrix A which consists of n rows and m columns, and contains integer numbers. Consider every possible vector v of m elements, such tha ...

Avatar

Canteen Bill by offer

") A new Canteen is opened in IIST Campus. Since today is the opening day, the canteen owner is giving an offer, in which every student must purchase 5 items each each of cost <1,000. The offer is, student can pay any amount, but the amount paid is t ...

Avatar

VALID PERFECT SQUARE

Get a positive integer. Let N be the number of test cases.Check the number whether perfect square or not.Print TRUE when the integer is perfect square.If it is not, return FALSE.Describe it without using built-in-function.Input format: The input is v ...

Avatar

REVERSE

"Dark was deeply studying in the afternoon and came across a concept called as ""REVERSE OF A NUMBER"". He decided to design a program which can reverse any long numbers. At the end of afternoon, he started to code and finally end up with no results ...

Avatar

COUNTING BITS

"Given N, if we write all numbers from 1 to N (both inclusive) in binary what is the count of 1s I have written. For example, if N=3, I will write down: 1 10 11 Therefore, a total of 4 ones. Input Format: First line contains, T, the num ...

Avatar

Sum of palindromic numbers

A number is called palindromic if its decimal representation is a palindrome. You are given a range, described by a pair of integers L and R. Find the sum of all palindromic numbers lying in the range [L, R], inclusive of both the extrema. Input ...

Avatar

Moving Coins

A triangle can be classified based on the lengths of its sides as equilateral, isosceles or scalene. All 3 sides of an equilateral triangle have the same length. An isosceles triangle has two sides that are the same length, and a third side t ...

Avatar

Find the Year

Most years have 365 days. However, the time required for the Earth to orbit the Sun is actually slightly more than that. As a result, an extra day, February 29, is included in some years to correct for this difference. Such years are referred to as l ...

Avatar

IO 5

Write a program to scan the given input and perform unary prefix increment and decrement operators. Condition : Variable name to be used: Preadd, Presub, Postadd, Postsub Perform the following operations: 1. Preadd = ++a 2. Presub = --a 3. Post ...

Avatar

IO 11

Write a program to calculate area of a circle Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the r ...

Avatar

Aloo Kachori

kenny has received a package of N ingredients from Aloo uncle and Kachori aunty as their Christmas gift. kenny decides to make dishes with every possible combination of these N ingredients. (Note: A dish with 0 ingredients is also possible. kenny use ...

Avatar

Sum of cube of Digits

Ganesh played game with his friend sanjay to find Sum of Cube of digits of the number he said. Help to Ganesh and sanjay to solve it by your code using union. Input Method Integer ranges from 1 to 999 Output Method Sum of Cube of digits of ...

Avatar

sum the numbers using union and structures

Kamachi decided to write one program in which she has to get one values using structure concept and another values using union concept, the result should add both values.Help to her to write code. Input Method Integer ranges from 1 to 999 O ...

Avatar

IO 35

Write a program to display a grocery bill of the product purchased in the small market by Vijay. Get the following details from Vijay: Get the product name Get the price of the product(Price per Unit) Get the quantity of the product purc ...

Avatar

UNIFORMITY MATRIX using Function

Uniformity matrix is a matrix in which all the elements in the matrix are either completely even or completely odd Test Case 1 Input (stdin) 2 4 5 5 4 Expected Output no Test Case 2 Input (stdin) 3 2 4 0 0 6 8 10 ...

Avatar

IO 31

Pranav intelligent in playing riddle with numbers so, he gave his sister a puzzle to solve in which she need to solve by adding the left side integral part of two decimal numbers. Explanation: Raju gave his sister two decimal numbers : 23.44 an ...

Avatar

ENCODING

In this program you will be given a letter to encode. The difference here is that different rules are used for different letters and the counting process can cause you to wrap around the alphabet. Using the numerical value of each letter (A=1, B=2, . ...

Avatar

Functions-Lucky String

Write a program to find whether the given string is Lucky or not. A string is said to be lucky if the sum of the ascii values of the characters in the string is even. Refer function specifications for the function details. The function acc ...

Avatar

Square Matrix

Given a square matrix of size NN, calculate the absolute difference between the sums of its diagonals. Input The first line contains a single integer N. The next N lines denote the matrix's rows, with each line containing N space-separated integ ...

Avatar

Railway – Seating arrangement for Sleeper Class

Write a program to determine the type of berth when the seat/berth number in the train is given. Input Format: Input consists of a single integer. Assume that the range of input is between 1 and 72. Output Format: Output consists of a s ...

Avatar

Write a C Program To implement Insertion Sort

Write a program to explain insertion sort . Which type of technique does it belong. (or) Write a C-program for sorting integers in ascending order using insertion sort. /*Program to sort elements of an array using insertion sort method*/ ...

Avatar

Blood bank

A team from Rotract club had planned to conduct a rally to create awarness among the coimbatore people to donate blood. They conducted the rally successfully . Many of the coimbatore people realized it and came forward to donate their blood to near b ...

Avatar

Vowel or Consonant

Write a program to determine whether the input character is a vowel or consonant. Input and Output Format: Input consists of a single character. Output consists of a string --- “Vowel” / “Consonant” / “Not an alphabet” Refer ...

Avatar

Write a C Program To Write function to upper the string

Write a C Program To Write function to Reverse the string ...

Avatar

Warm up

This is a very easy warm-up problem. You are given a string. Your task is to determine whether number of occurrences of some character in the string is equal to the sum of the numbers of occurrences of other characters in the string. Input Th ...

Avatar

Alphabetical Order

Write a program which will read a string and rewrite it in the alphabetical order. For example, the word STRING should be written as GINRST Test Case 1 Input (stdin) string Expected Output ginrst Test Case 2 Input (stdin) srmuni ...

Avatar

Query over Matrix

" There is a N*N square matrix. You have been given N specifications, one per row of the matrix. The ith specifications is represented by a pair of integers L[i] and R[i], denoting that all element belonging to columns between L[i] and R[i] (both i ...

Avatar

Prime Number between Limits

"As we all know, Virat Kohli is in the form of his life and hitting centuries has become his habit. Bollywood diva Anushka Sharma is interested in knowing if the number of centuries he would score in two consecutive years would be two consecutive p ...

Avatar

Mike and Matrices

"Mike is given a matrix A, N and M are numbers of rows and columns respectively. A1, 1 is the number in the top left corner. All the numbers in A are non-negative integers. He also has L pairs of integers (ik, jk). His task is to calculate Ai1, j1 + ...

Avatar

Pattern 6

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample output. There is a trailing space at the end of each line. Sample Input: 5 5 4 5 3 4 ...

Avatar

Pattern 7

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample output. There is a trailing space at the end of each line. Sample Input: 5 1 2 2 3 ...

Avatar

Square in numbers

Leha is a bright mathematician. Today he is investigating whether an integer is divisible by some square number or not. He has a positive integer X represented as a product of N integers a1, a2, .... aN. He has somehow figured out that there e ...

Avatar

Series 4

Write a program to generate the first n terms in the series --- 6,11,21,36,56,... Input Format: Input consists of a single integer which corresponds to n. Output Format: Output consists of the terms in the series separated by a ...

Avatar

Pattern 5

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample outputs. There is a trailing space at the end of each line. Sample Input: 5 Sample Outpu ...

Avatar

Program to find sum of first and last digit using loop

...

Avatar

Devu and friendship testing

Devu has n weird friends. Its his birthday today, so they thought that this is the best occasion for testing their friendship with him. They put up conditions before Devu that they will break the friendship unless he gives them a grand party on their ...

Avatar

Pattern 4

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample outputs. There is a trailing space at the end of each line. Sample Input: 5 5 4 3 2 1 5 4 ...

Avatar

SUM of all integers

"Yesterday, puppy Tuzik learned a magically efficient method to find the sum of the integers from 1 to N. He denotes it as sum(N). But today, as a true explorer, he defined his own new function: sum(D, N), which means the operation sum applied D ti ...

Avatar

ARDUINO PULSE SENSOR

...

Avatar

Valid IdentifierChecker

An identifier in C, Java, C++ and most other programming languages must begin with a letter and then may be followed by any number of letters or digits. It is possible that underscores (_) will also appear, but only in the middle and never two ...

Avatar

Pattern 3

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample outputs. There is a trailing space at the end of each line. Sample Input: 5 5 4 3 2 1 4 ...

Avatar

Reverse string

If an Integer N, write a program to reverse the given number. Input The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N. Output Display the reverse of the given number N. Co ...

Avatar

Series 2

Write a program to generate the first n terms in the series --- 20,19,17,..,10,5 Input Format: Input consists of a single integer which corresponds to n. Output Format: Output consists of the terms in the series separated by a b ...

Avatar

Pattern 2

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample outputs. There is a trailing space at the end of each line. Sample Input: 5 1 2 3 4 5 ...

Avatar

Pattern 8

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample output. There is a trailing space at the end of each line. Sample Input: 5 Sample Output ...

Avatar

Average & standard deviation

Gowri asks Reshmi to write a code to read n numbers (Xi) from the user and print out their average and standard deviation. Formulae are Average = (Sum of Xi)/n , Standard Deviation= Sum of (Xi *Xi)/(n*n). Help her to do this task Test Case ...

Avatar

Pattern 9

Write a program to print the given pattern. Input Format: Input consists of a single integer. Output Format: Refer sample output. There is a trailing space at the end of each line. Sample Input: 5 Sample Output: ...

Avatar

Magical game of sum

Yesterday, puppy Tuzik learned a magically efficient method to find the sum of the integers from 1 to N. He denotes it as sum(N). But today, as a true explorer, he defined his own new function: sum(D, N), which means the operation sum applied D times ...

Avatar

Print 1

Write a C program to print all numbers between a and b (a and b inclusive) using a while loop. Input Format: Input consists of 2 integers. The first integer corresponds to a and the second integer corresponds to b. Assume a<=b. Outp ...

Avatar

Program to find sum of first and last digit without using loop

...

Avatar

HOTEL TARIFF CALCULATOR

Write a C program to calculate the hotel tariff. The room rent is 20% high during peak seasons [April-June, November-December] . Use Switch statement. Input Format: The first line of the input contains an integer which corresponds to the ...

Avatar

Mark The Answer

Our friend Monk has an exam that has quite weird rules. Each question has a difficulty level in the form of an Integer. Now, Monk can only solve the problems that have difficulty level less than X . Now the rules are- Score of the student is equ ...

Avatar

Sine series

Python Program to Find the Sum of Sine Series Input First Line : The value of x in degrees Second Line: The number of terms Output Print the Sum of Sine series TEST CASE 1 INPUT 30 10 OUTPUT 0.5 ...

Avatar

Electric town

Tom want to know about the calculation of electricity charges. Explain him about the calculation by using C code to reads the customer number and power consumed and prints the amount to be paid by the customer.Consumption Rate of Units Charge - ...

Avatar

armstrong number or not

Example Input Input number: 371 Output 371 is armstrong number ...

Avatar

Electric town

Tom want to know about the calculation of electricity charges. Explain him about the calculation by using C code to reads the customer number and power consumed and prints the amount to be paid by the customer.Consumption Rate of Units Charge - ...

Avatar

CamelCase

Alice wrote a sequence of words in CamelCase as a string of letters, S, having the following properties: 1. It is a concatenation of one or more words consisting of English letters. 2. All letters in the first word are lowercase. 3. For ...

Avatar

Gizmos

An online retailer sells two products: widgets and gizmos. Each widget weighs 75 grams and Each gizmo weighs 112 grams. Write a program that reads the number of widgets and the number of gizmos in an order from the user. Then your pr ...

Avatar

Turbo Sort

Given the list of numbers, you are to sort them in non decreasing order. Input t – the number of numbers in list, then t lines follow [t <= 10^6]. Each line contains one integer: N [0 <= N <= 10^6] Output Output given numbers in non d ...

Avatar

Anagrams

Write a program to find whether the 2 given strings are anagrams or not. Anagrams are words or phrases made by mixing up the letters of other words or phrases, Input and Output Format: Input consists of 2 string. Assume that all characters i ...

Avatar

TENNIS COURT

Many of the current final year students of a college are excellent tennis players. They always emerge as champions in the State Level Inter-Collegiate Tennis Meet. They want their juniors to carry on their legacy in the field of tennis and they start ...

Avatar

Panagram

Write a Python program to check whether the given string is Pangram or not Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to in ...

Avatar

Series 3

Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17 Input Format: Input consists of a single integer which corresponds to n. Output Format: Output consists of the terms in the series separated by a blan ...

Avatar

ACII VALUE CHART

...

Avatar

Letter Frequency

Write a program to compute the frequency of each lowercase letter in the string. Input and Output Format: Input consists of a string. Assume that all characters in the string are lowercase letters and the maximum length of the string is 200. ...

Avatar

LETTER GRADE

At a particular university, letter grades are mapped to grade points in the following manner: Letter Grade points A+ 4.0 A 4.0 A- 3.7 B+ 3.3 B 3.0 B- 2.7 C+ 2.3 C 2.0 C- 1.7 D+ 1.3 D 1.0 F 0 Write a program that begins by reading a ...

Avatar

Sieve of Eratosthenes

Python Program to Read & Print Prime Numbers in a Range using Sieve of Eratosthenes. To find all the prime numbers less than or equal to a given integer n by Eratosthenes' method: Create a list of consecutive integers from 2 through n: ...

Avatar

MODULO OF NUMBERS

Jennys home work for Fifth day is to find modulo of two numbers, help jenny to solve the problem. Test Case 1 Input (stdin) 6 2 Expected Output The reminder of two number is:0 Test Case 2 Input (stdin) 5 2 Expected O ...

Avatar

Factorial

Write a program to find the factorial for the given number Input 1:Negative number Output: Display the message "Sorry,factorial does not exist for negative numbers" Input 2: Positive number Output: Display the factorial ...

Avatar

Median of three Values

Write a function that takes three numbers as parameters, and returns the median value of those parameters as its result. Include a main program that reads three values from the user and displays their median. Hint: The median value is the middle ...

Avatar

Anagrams

Write a function to check whether two given strings are anagram of each other or not. An anagram of a string is another string that contains same characters, only the order of characters can be different. For example, abcd and dabc are anagram of eac ...

Avatar

Strong Number

Write a program to check whether the given number is Strong number or not Input:Positive number Output:Display the appropriate message Refer sample input and output for formatting specification. TEST CASE 1 INPUT 145 ...

Avatar

Vowels

Implement the following algorithm 1. Take a string from the user and store it in a variable. 2. Initialize a count variable to 0. 3. Use a for loop to traverse through the characters in the string. 4. Use an if statement to check if ...

Avatar

Remove Vowels

Write a program that accepts a string and redisplays the same string after removing vowels from it. TEST CASE 1 INPUT welcome OUTPUT wlcm ...

Avatar

Number of Occurences of a Character

Write a program find the number of occurrences of a character in a given string. Input: First line is the string, s Second line is the character, c Output: An integer, i.e. the number of occurrences of c in s. TEST CASE 1 INPUT ...

Avatar

Sum of Positive Negative

Write a program to find the sum of odd numbers, even numbers and negative numbers Input:Positive and negative numbers Output:Display Sum of ODD,EVEN and NEGATIVE numbers respectively. Refer sample input and output for formatting ...

Avatar

Prime Generator-2

Write a program to find prime numbers between two range excluding the starting and ending number of given range Input 1: Lower Range Input 2: Upper Range Output: List of prime numbers Refer sample input and output for f ...

Avatar

Numbers, Alphabets and Spaces

Write a Python program to count the numbers, alphabets and spaces in the entered string. Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold correspon ...

Avatar

Star Pattern 1

Write a program to print the star pattern Input:Number of rows Output:Star pattern Refer sample input and output for formatting specification. ...

Avatar

Replace it

Problem Solution 1. Take a string from the user and store it in a variable. 2. Pass the string as an argument to a function. 3. In the function, split the string. 4. Then add the last character to the middle part of the string which is ...

Avatar

Replace it

Problem Solution 1. Take a string from the user and store it in a variable. 2. Pass the string as an argument to a function. 3. In the function, split the string. 4. Then add the last character to the middle part of the string which is ...

Avatar

Replacing Whitespaces

Write a program to replace whitespaces in a string by *. TEST CASE 1 INPUT Welcome to India OUTPUT Welcome*to*India ...

Avatar

Sum on n number

Write a program to find the sum of numbers Input 1:Negative number Output: Display the appropriate error message Input 2: Positive number Output: Display the sum Refer sample input and output for formatting specificatio ...

Avatar

Combinations

Python Program to Accept Three Digits and Print all Possible Combinations from the Digits. ...

Avatar

Multiple Layer a and b

Write a program to find the numbers divisible by a input numbers within the given range Input 1:Lower range Input 2:Upper range Input 3:Positive number Input 4:Positive number Output:Numbers divisible by given input numbers within ...

Avatar

Multiplication Table

Write a program to print multiplication table as shown in the test cases TEST CASE 1 INPUT 2 5 OUTPUT 1 * 2 = 2 2 * 2 = 4 3 * 2 = 6 4 * 2 = 8 5 * 2 = 10 ...

Avatar

Exponentation- Part B

Write a program to find the exponentation of given number Input 1: Base Input 2: Number of inputs Output: List of exponentation terms for the given input ...

Avatar

September to December

QUESTION DESCRIPTION The length of a month varies from 30 and 31 days. In this exercise you will create a program that reads the name of a month from the user as a string. The program should get input from September to December.I If ...

Avatar

Name that Triangle

A triangle can be classified based on the lengths of its sides as equilateral, isosceles or scalene. All 3 sides of an equilateral triangle have the same length. An isosceles triangle has two sides that are the same length, and a third side ...

Avatar

Earth Quake

The following table contains earthquake magnitude ranges on the Richter scale and their descriptors: Magnitude Descriptor Less than 2.0 Micro 2.0 to less than 3.0 Very minor 3.0 to less than 4.0 Minor 4.0 to less than 5.0 Light ...

Avatar

Sum of Even and Odd

Write a program to calculate the sum of even and odd numbers including its count. Input: 1.Total number of Inputs 2. Input elements Output: 1. Odd numbers count 2. Even numbers count 3. Sum of even numbers 4. Sum of odd nu ...

Avatar

Mirror Image

Puck, the trickster, has again started troubling people in your city. The people have turned on to you for getting rid of Puck. Puck presents to you a number consisting of numbers from 0 to 9 characters. He wants you to reverse it from ...

Avatar

Find Year

Most years have 365 days. However, the time required for the Earth to orbit the Sun is actually slightly more than that. As a result, an extra day, February 29, is included in some years to correct for this difference. Such years are referred to as l ...

Avatar

Note To Frequency - G NOTE

The following table lists an octave of music notes, beginning with middle G, along with their frequencies. Note Frequency (Hz) G4 392.00 Begin by writing a program that reads the name of a note from the user and displays the notes freque ...

Avatar

ARDUINO EMG SENSOR

...

Avatar

Name of the Shape

Write a program that determines the name of a shape from its number of sides. Read the number of sides from the user and then report the appropriate name as part of a meaningful message. Your program should support shapes with anywhere from ...

Avatar

Day Old Bread

A bakery sells loaves of bread for 185 rupees each. Day old bread is discounted by 60 percent. Write a program that begins by reading the number of loaves of day old bread being purchased from the user. Then your program should display the reg ...

Avatar

Y2K Problem Detector

Write a program that asks a user for their birth year encoded as two digits (like "62") and for the current year, also encoded as two digits (like "99"). The program is to correctly write out the users age in years. Input Format: Input cons ...

Avatar

Richter Scale

The following table contains earthquake magnitude ranges on the Richter scale and their descriptors: Magnitude Descriptor Less than 2.0 Micro 2.0 to less than 3.0 Very minor 3.0 to less than 4.0 Minor 4.0 to less than 5.0 Light ...

Avatar

IO 34

Help Vijay to calculate his first salary that he got from the SRM University, he was confused with an salary credited in his savings account. He asked his friend Rohit to identify how salary pay got calculated. Rohit gave him the following details an ...

Avatar

May to August

The length of a month varies from 30 and 31 days. In this exercise you will create a program that reads the name of a month from the user as a string. The program should get input from May to August. If the input is from may to other m ...

Avatar

Area of a Field

Create a program that reads the length and width of a farmers field from the user in feet. Display the area of the field in acres. Hint: There are 43,560 square feet in an acre SQ=43560; (Squarefeet) Formula = (l ...

Avatar

Conversion

Chris was given a task by his friend rajesh. When rajesh tells a number then chris needs to convey the value in binary, octal, hexadecimal for the decimal equivalent value told by his friend rajesh. Help them to achieve this task ...

Avatar

POINTERS 10

Write a program to add two integers using functions use call by address technique of passing parameters and also illustrate the concept of pointer variables can be used to access the strings. Input and Output Format: Refer sample input and outp ...

Avatar

Sum of the Series

Write a program to find sum of series Hint:1+2+3+4+n ...

Avatar

THREE IDIOTS

Ajay, Binoy and Chandru were very close friends at school. They were very good in Mathematics and they were the pet students of Emily Mam. Their gang was known as 3-idiots. Ajay, Binoy and Chandru live in the same locality. A new student Dinesh join ...

Avatar

Area of a Room

Write a program that asks the user to enter the width and length of a room. Once the values have been read, your program should compute and display the area of the room. The length and the width will be entered as floating point numbers. In ...

Avatar

Display It

reate a program that displays your name and complete mailing address formatted in the manner that you would usually see it on the outside of an envelope. Your program needs to read any input from the user ...

Avatar

Age Calculator

Declare me as an integer. Get two integer values as mentioned in sample input and output Declare average as a float and assign it the average of me and you. Then using one printf for each line, print the following. The numbers are printed using th ...

Avatar

Sum of N series

Python Program to Read a number n and Compute n+nn+nnn ...

Avatar

INVERSION COUNT USING FUNCTION

Write a program to find the ARRAY Inversion array. Inversion Count for an array indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion c ...

Avatar

Units of Time

Create a program that reads a duration from the user as a number of days, hours, minutes, and seconds. Compute and display the total number of seconds represented by this duration. ...

Avatar

Read Long Number and Split it Into Odd and Even

Input is accepted by variable n. Odd and even numbers are extracted from this variable n using pointers n1 and n2. The variable n is divided by 10 and the remainder is stored in variable r. The quotient obtained after this division is considered as v ...

Avatar

Half pyramid

Sam had a program for a full pyramid. But he didnt know that how to print half pyramid by using alphabets. So help him to write a program to print half pyramid using alphabets using increment operator Test Case 1 Input (stdin) G ...

Avatar

POINTERS -34

Write a function that accepts a string using pointers. In the function ,delete all the occurrences of a given character and display the modified string on the screen (Case Insensitive) Refer sample input and output for formatting specification. ...

Avatar

Calculate Average Using Arrays

...

Avatar

PRINTING PREVIOUS

Latha and Trisha are friends. They love to play with words. Ishu gives them a task to replace each characters in a string with its previous letter. Can you help them to complete this task? Test Case 1 Input (stdin) bcd Expected Output a ...

Avatar

GOOD NUMBERS

A number is called a square free number if there does not exist a number greater than 1, whose square divides the number evenly/perfectly. For example, number 8 is not a square free number as number 4 (which is square of 2), divides 8. Similarly, num ...

Avatar

PLACING THE FLAG POST

The shape of the college ground is Square. For the Independence day Flag Hoisting Function, it has been decided to place the flag post at the exact center of the ground. Can you please help them in placing the flag post at the exact center? Gi ...

Avatar

Pointer - 2

Write a program to enter a lowercase character. Print this character in uppercasa and also display its ASCII value Input and Output Format: Refer sample input and output for formatting specification. All float values are displaye ...

Avatar

FRONT AND BACK

Rand has a task to find the sum of first and last digit of number upto given n numbers.Help him in writing C code to enter any number and find the sum of first and last digit of the number using for loop. Test Case 1 Input (stdin) 1234 Ex ...

Avatar

POINTER -10

Write a program to add two integers using functions use call by address technique of passing parameters and also illustrate the concept of pointer variables can be used to access the strings. Input and Output Format: Refer sample input and outp ...

Avatar

INVERSION COUNT USING FUNCTION

Write a program to find the ARRAY inversion array. Inversion Count for an array indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion c ...

Avatar

How many bits?

Sasha ask Diya to write a program to get minimum number of bits to store an integer number. Devi thinks a lot but she could not able to do this.Can you help her to derive a solultion for this? Test Case 1 Input (stdin) 127 Expected Output ...

Avatar

Sum of Negative Numbers

Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers. If the input array is empty or null, return an empty array: Test Case 1 Input (stdin) 15 1 2 3 4 5 6 7 8 9 10 ...

Avatar

POINTERS -9

Write a program to input 10 values in an array. Categorize each value as prime or composite using pointers. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 deci ...

Avatar

POINTERS-10

Write a program to add two integers using functions use call by address technique of passing parameters and also illustrate the concept of pointer variables can be used to access the strings. Input and Output Format: Refer sample input and outp ...

Avatar

VALUE INSERTION IN THE ARRAY

Write a program using pointers to insert a value in an array. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to ...

Avatar

VALUE INSERTION IN THE ARRAY

Write a program using pointers to insert a value in an array. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to ...

Avatar

Pointers 6

Write a program to input a character and Categorize it as a vowel and consonant Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in b ...

Avatar

Pointer - 20

Write a program using pointers to insert a value in an array. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to ...

Avatar

ARDUINO

Introduction Arduino is an open-source hardware and software company, project and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devic ...

Avatar

POINTERS 48

Write a program to reverse a string using pointer Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input a ...

Avatar

POINTERS-48

Write a program to reverse a string using pointer Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and t ...

Avatar

POINTER -4

Write a program to convert floating point values into its integral equivalent using pointer Input and Output Format: All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds t ...

Avatar

ARDUINO SODA DISPENSER

...

Avatar

ARDUINO HUMIDITY SENSOR

...

Avatar

ARDUINO HUMIDITY SENSOR

...

Avatar

LCM PART

Write a program to find the Least common divisor of the given numbers Input 1: Positive number Input 2: Positive number Output: Least common divisor Refer sample input and output for formatting specification. Test Case 1 Input (stdi ...

Avatar

Length Without Library

Write a python program to find the length of the given string without using Library Function Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds ...

Avatar

COUNT IT

Write a program to get the inputs from the user and display the count element Input 1. The number of inputs 2. The input elements 3. The element to be counted Output: Total Count of numbers (Input step 3) Test Case 1 Input (stdin) 7 ...

Avatar

Star Pattern 1

Write a program to print the star pattern Input:Number of rows Output:Star pattern Refer sample input and output for formatting specification. Test Case 1 Input (stdin) 5 Expected Output ***** **** *** ** * Test C ...

Avatar

The length

Write a Program to find the length of the given string. Hint: Use len function Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input a ...

Avatar

X and X*X

Python Program to Generate a Dictionary that Contains Numbers (between 1 and n) in the Form (x,x*x). Test Case 1 Input (stdin) 5 Expected Output {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} Test Case 2 Input (stdin) 4 Expected Output ...

Avatar

Vowels

Implement the following algorithm 1. Take a string from the user and store it in a variable. 2. Initialize a count variable to 0. 3. Use a for loop to traverse through the characters in the string. 4. Use an if statement to check if the charac ...

Avatar

Vowels

Implement the following algorithm 1. Take a string from the user and store it in a variable. 2. Initialize a count variable to 0. 3. Use a for loop to traverse through the characters in the string. 4. Use an if statement to check if the charac ...

Avatar

Swap Letters

Write a program to implement the following string operations. Input: You are given two strings, s1 and s2, separated by a new line. Each string will consist of lower case Latin characters ('a'-'z'). Output: In the first line, print two space-sepa ...

Avatar

Count Me please with spaces

Write a Python program to count the number of lower-case letter, uppercase letters and spaces in the entered string. Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All ...

Avatar

Replace it

Problem Solution 1. Take a string from the user and store it in a variable. 2. Pass the string as an argument to a function. 3. In the function, split the string. 4. Then add the last character to the middle part of the string which is in turn ...

Avatar

Replace me if you can

Raj will utter some sentence to his friend. Upon listening to Raj now raju needs to write those sentences told by his friend. Then raj will utter a word. The task is replace all the words that has been uttered by raj in the sentence with a specia ...

Avatar

CamelCase

Given S, print the number of words in S on a new line. Input: A single line containing string S. Output: Print the number of words in string S. Test Case 1 Input (stdin) thisIsIndiaWelcome Expected Output 4 Test Case 2 Input (s ...

Avatar

Biggest Idiot

Write a Python program to find the biggest string based on the length function. The user should get two string inputs and compare the string Print the longest or biggest string in the output. If the strings are equal then print the message a ...

Avatar

Print First

Given a string containing only lower case letters, print first occurrence of all the letters present in that order only Test Case 1 Input (stdin) 3 tamilnadu madam india Expected Output tamilndu mad inda Test Case 2 ...

Avatar

Count Number

Write a program to count the number of digits. Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds to output ...

Avatar

LCM Check

Write a python function to calculate the LCM of numbers Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds to ...

Avatar

Count Number

Write a program to count the number of digits. Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and the rest corresponds to output ...

Avatar

Is Valid Prime

A prime number is an integer greater than 1 that is only divisible by one and itself. Write a function that determines whether or not its parameter is prime, returning True if it is, and False otherwise. Write a main program that reads an integer ...

Avatar

Compute the Hypotenuse

Write a function that takes the lengths of the two shorter sides of a right triangle as its parameters. Return the hypotenuse of the triangle, computed using Pythagorean theorem, as the functions result. Include a main program that reads the leng ...

Avatar

Cosine series

Python Program to Find the Sum of Cosine Series Input: First Line : Value of x in degrees Second Line :Number of terms Output: Print the Sum of Cosine Series Test Case 1 Input (stdin) 65 10 Expected Output 0.42 Test Case 2 ...

Avatar

Odd Print

Write a program to print all the odd numbers between two ranges(Include the range too) Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to in ...

Avatar

Amicable

Write a python function to calculate whether the numbers are amicable or not Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and ...

Avatar

Cumilative Sum

Python Program to find the cumulative sum of a list where the ith element is the sum of the first i+1 elements from the original list Input: First Line:Number of Elements in the List Second Line:Elements of the List Output: Print the Resulting ...

Avatar

Dynamic Dictionaries

Write a program to form dynamic dictionaries and display it Input: 1.Get the number of dictionaries 2. The key-value elements for dictionaries Output: 1. Display dictionary Test Case 1 Input (stdin) 3 153 154 155 351 ...

Avatar

Sine series

Python Program to Find the Sum of Sine Series Input First Line : The value of x in degrees Second Line: The number of terms Output Print the Sum of Sine series Test Case 1 Input (stdin) 30 10 Expected Output 0.5 Test Cas ...

Avatar

Reverse Order

Write a program that reads integers from the user and stores them in a list. Use 0 as a sentinel value to mark the end of the input. Once all of the values have been read your program should display them (except for the 0) in reverse order, with ...

Avatar

Searching Linear

Write a program to search a element linearly Test Case 1 Input (stdin) 5 2 3 4 10 40 3 Expected Output Element is present at index 1 Test Case 2 Input (stdin) 5 2 3 4 10 40 10 Expected Output ...

Avatar

Transpose of Matrix

Write a python program to create a NESTED LIST and print the diagonal elements of the matrix Hint: 1. Input the number of rows First Matrix 2. Input the number of Columns for first Matrix 3. Display the elements of the matrix 4. Displa ...

Avatar

Swap first and last

Python Program to Swap the First and Last Value of a List Input: First Line:Number of elements in list Second Line:Elements of the List Output: Print the new list after swapping Test Case 1 Input (stdin) 4 23 45 67 ...

Avatar

Dictionary Using List

Write a program to get the input of key and value of the element in dictionary. Display the key-value pair in the python dictionary format. Kindle get the input using List Concept. Input: 1. Size of first list 2. Elements of first list 3. ...

Avatar

Iot Based Industrial Automation

...

Avatar

Odd and Even in a list

Python Program to Put Even and Odd elements in a List into Two Different Lists Input First Line is the Number of Inputs Second line is the elements of the list Output Print the Even List and Odd List Test Case 1 Input (stdin) 5 67 ...

Avatar

Seasoners

The year is divided into four seasons: spring, summer, fall and winter. While the exact dates that the seasons change vary a little bit from year to year because of the way that the calendar is constructed, we will use the following dates for this ex ...

Avatar

Sorted Order

Write a program that reads integers from the user and stores them in a list. Your program should continue reading values until the user enters 0. Then it should display all of the values entered by the user (except for the 0) in order from smallest t ...

Avatar

Sorted Order

Write a program that reads integers from the user and stores them in a list. Your program should continue reading values until the user enters 0. Then it should display all of the values entered by the user (except for the 0) in order from smallest t ...

Avatar

PRINT INDEX

How to find all occurrences of a character in a given string using for loop in C programming. Program to print all index of a character in a given string. Test Case 1 Input (stdin) u srmuniversity Expected Output u is found at ind ...

Avatar

Reverse and Remove

Write a Program to create a list and get the input from the user. Hint: 1. Get the size of the first list from the user 2. Get the size of the second list from the user 3. Get the elements of the first list 4. Get the elements of the sec ...

Avatar

ARDUINO WATER DISPENSER

...

Avatar

DIAGONAL MATRIX

Diagonal Matrix.A square matrix which has zeros everywhere other than the main diagonal. Entries on the main diagonal may be any number, including 0. Write a program to find whether a given matrix is a diagonal matrix or not. Input Format: ...

Avatar

Length of List

Write a program to find the length of the list Input: 1. The Size of First List 2. The Size of Second List 3. First List elements 4. Second List elements Output: 1. Length of First List 2. Length of Second List 3. First List Data 4. ...

Avatar

Check the Key

Write a program to check whether the given key is present in the dictionary. If the key is present then display the value of the entered key and if the key is not present then display the appropriate message Input: 1.Get two dictionaries key ...

Avatar

Length of List

Write a program to find the length of the list Input: 1. The Size of First List 2. The Size of Second List 3. First List elements 4. Second List elements Output: 1. Length of First List 2. Length of Second List 3. First List Data 4. F ...

Avatar

COMPARE 2 ARRAYS USING FUNCTION

Write a program to find whether 2 arrays are the same. Input Format: Input consists of 2n+1 integers. The first integer corresponds to n , the size of the array. The next n integers correspond to the elements in the first array. The next n inte ...

Avatar

DIAGONAL MATRIX

Diagonal Matrix.A square matrix which has zeros everywhere other than the main diagonal. Entries on the main diagonal may be any number, including 0. Write a program to find whether a given matrix is a diagonal matrix or not. Input Format: ...

Avatar

Length of List

Write a program to find the length of the list Input: 1. The Size of First List 2. The Size of Second List 3. First List elements 4. Second List elements Output: 1. Length of First List 2. Length of Second List 3. First List Data 4. ...

Avatar

LAPINDROME

Lapindrome is defined as a string which when split in the middle, gives two halves having the same characters and same frequency of each character. If there are odd number of characters in the string, we ignore the middle character and check for lapi ...

Avatar

NUMBER PATTERN

Consider group of boys are standing in a ground. They should be stand like n*n matrix after giving the value of n.The condition is same color dress weared boys should be in same column.The boys can sit in each row who should be in diagonal.The diagon ...

Avatar

Length of List

Write a program to find the length of the list Input: 1. The Size of First List 2. The Size of Second List 3. First List elements 4. Second List elements Output: 1. Length of First List 2. Length of Second List 3. First List Data 4. F ...

Avatar

FREQUENCY OF EACH

Write a C program to count frequency of each character in a string using loop. Test Case 1 Input (stdin) srmuniversitylearningcentre Expected Output a = 1 c = 1 e = 4 g = 1 i = 3 l = 1 m = 1 n = 4 r = 4 s = 2 ...

Avatar

Range Function

Write a program to find the range of squares using List Input: 1. The Lower range 2 The upper range Output: The square of upper and lower number using list Test Case 1 Input (stdin) 2 5 Expected Output [(2, 4), (3, 9), (4, 16 ...

Avatar

Plant location

"A new highway called Highway 1 has just been built in the Kingdom of Byteland. Ingoo, the largest CPU manufacturer in Byteland, would like to build a new chipset plant along the highway. Ingoo currently has N warehouses in the kingdom. None of th ...

Avatar

Diagonal Sum

Write a python program to create a NESTED LIST and print the sum of the diagonal elements in the matrix Hint: 1. Input the number of rows First Matrix 2. Input the number of Columns for Second Matrix 3. Display the sum of the diagonal e ...

Avatar

QUERIES ON THE STRING

"You have a string of N decimal digits, denoted by numbers A1,A2, ..., AN. Now you are given M queries, each of whom is of following two types. Type 1: 1 X Y: Replace AX by Y. Type 2: 2 C D: Print the number of sub-strings divisible by 3 of ...

Avatar

Largest Number

Python Program to Find the Largest Number in a List. Input : First Line: Number Of Elements in the list Second Line: Elements of the List Output : Prints the largest element of the list Test Case 1 Input (stdin) 3 23 567 3 E ...

Avatar

WORDSTEM

Given n words w[1..n], which originate from the same stem (e.g. grace, graceful, disgraceful, gracefully), we are interested in the original stem. To simplify the problem, we define the stem as the longest consecutive substring that occurs in all the ...

Avatar

Multiply List Elements

Write Python Program to Multiply All the Items in a Dictionary. Test Case 1 Input (stdin) 10 10 239 Expected Output 23900 Test Case 2 Input (stdin) 0 Expected Output 0 ...

Avatar

Raju Dilemma

Given an array of size N and an integer X, Raju wants to know how many elements in the array are divisible by X. Help him find the answer. Input Format First line contains 2 integers N and X. Second line contains N integers, the array arr[N]. ...

Avatar

Overlapping rectangles

Given two rectangles, find if the given two rectangles overlap or not. A rectangle is denoted by providing the x and y co-ordinates of two points: the left top corner and the right bottom corner of the rectangle. Note that two rectangles sharing a ...

Avatar

Chef and Balls

Chef has bought ten balls of five colours. There are two balls of each colour. Balls of same colour have same weight. Let us enumerate colours by numbers from 1 to 5. Chef knows that all balls, except two (of same colour), weigh exactly one kilogram. ...

Avatar

Play With Strings

Given are two strings(each not more than 100 characters). We need to find relation between them such that all the characters of the second string must appear in the first string sequentially (not necessarily continuously). The program should : Pri ...

Avatar

Find increment sequence

Perform sorting on list of integers and print the sequence showing order of increment. Test Case 1 Input (stdin) 5 11 24 77 66 55 Expected Output Sorted List: [11, 24, 55, 66, 77] Sequence of increments: [13, 31, 11, 11] T ...

Avatar

SQUARE SUM

"Everyone knows what a square looks like. Mathematically, a square is a regular quadrilateral. This means that it has four equal sides and four equal angles (90 degree angles). One beautiful day, Johnny eagerly examined the interesting properties ...

Avatar

FIND PEAK ELEMENT

Take an input array.The array consists of list of numbers, where num[i] is not equal to num[i+1].The mission is to print the peak element and also print its index value.INPUT FORMAT: Get an input array with a list of numbers. OUTPUT FORMAT:Print the ...

Avatar

CHEF AND THE WILDCARD MATCHING

Chef wants to implement wildcard pattern matching supporting only the wildcard ?. The wildcard character ? can be substituted by any single lower case English letter for matching. He has two strings X and Y of equal length, made up of lower case lett ...

Avatar

FIND PEAK ELEMENT

Take an input array.The array consists of list of numbers, where num[i] is not equal to num[i+1].The mission is to print the peak element and also print its index value.INPUT FORMAT: Get an input array with a list of numbers. OUTPUT FORMAT:Print the ...

Avatar

CALCULATING SP

A man buys a cycle for Rs. a and sells it at a loss of b%. What is the selling price of the cycle? Write a C program to compute the selling price. Input Format: The first input is an integer which corresponds to a. The second input is an integer w ...

Avatar

HOTEL TARIFF CALCULATOR

Write a C program to calculate the hotel tariff. The room rent is 20% high during peak seasons [April and May] . Use Switch statement. Input Format: The first line of the input contains an integer which corresponds to the number of the month. [ ...

Avatar

DIAGONAL MATRIX

Diagonal Matrix.A square matrix which has zeros everywhere other than the main diagonal. Entries on the main diagonal may be any number, including 0. Write a program to find whether a given matrix is a diagonal matrix or not. Input Format: ...

Avatar

Greedy puppy

Tuzik is a little dog. But despite the fact he is still a puppy he already knows about the pretty things that coins are. He knows that for every coin he can get very tasty bone from his master. He believes that some day he will find a treasure and ha ...

Avatar

PATTERN 2

Write a program to generate a following #s triangle: # # # # # # # # # # # # # # # Test Case 1 Input (stdin) 5 Expected Output ##### #### ### ## # Test Case 2 Input (stdin) 7 Expected Output ####### ###### ...

Avatar

REVERSE OF DIGITS

Mahesh played game with his friend sanjay to find Reverse of digits of the number he said. Help to Mahesh and sanjay to solve it by your code using union. Input Method Integer ranges from 1 to 999 Output Method Reverse of digits of the n ...

Avatar

POINTER -26

Write a program to compare two arrays using pointers. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input a ...

Avatar

GREEDY ACTOR

Tuzik is a little dog. But despite the fact he is still a puppy he already knows about the pretty things that coins are. He knows that for every coin he can get very tasty bone from his master. He believes that some day he will find a treasure and ha ...

Avatar

REMAINDER

Write a program to find the remainder when two given numbers are divided. he first line contains an integer T, total number of test cases. Then follow T lines, each line contains two Integers A and B. Find remainder when A is divided by B Test Cas ...

Avatar

QUOTIENT REMINDER

Write a C program to find the quotient and remainder for the given dividend and divisor. Test Case 1 Input (stdin) 25 4 Expected Output 6 1 Test Case 2 Input (stdin) 35 6 Expected Output 5 5 ...

Avatar

SUM IT NOW

Nilo and Teena are playing with each other. Nilo challenges Teena to sum the digit of a number. Help Teena to answer as quick as possible. Test Case 1 Input (stdin) 300 Expected Output 3 Test Case 2 Input (stdin) 16789 Expected O ...

Avatar

COMPANY INCREMENT

At a particular company, employees are rated at the end of each year. The rating scale begins at 0.0, with higher values indicating better performance and resulting in larger raises. The value awarded to an employee is either 0.0, 0.4, or 0.6 or more ...

Avatar

PATTERN 5

Problem Description Write a program to generate a following @s triangle: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ Test Case 1 Input (stdin) 5 Expected Output @ @@ @@@ @@@@ @@@@@ Test Case 2 Input (stdin) 9 Expected Outp ...

Avatar

PATTERN 6

Write a program to generate a following numbers structure Test Case 1 Input (stdin) 5 Expected Output 12345 12345 12345 12345 12345 Test Case 2 Input (stdin) 3 Expected Output 123 123 123 ...

Avatar

IO 24

Selvan from SRM Public school is studying 3r grade in school, her maths mam gave her a problem to convert the decimal number in octal and hexadecimal . Since her mam gave so much problems to solves.She went to his brother who is computer programmer ...

Avatar

SMS Languages

SMS language or textese (also known as txt-speak, txtese, chatspeak, txt, txtspk, txtk, txto, texting language, txt lingo, SMSish, txtslang,or txt talk) is a term for the abbreviations and slang commonly used with mobile phone text messaging. Some ...

Avatar

CONVERSION ON SPECIFIC

Write a C program to convert specified days into years, weeks and days. Test Case 1 Input (stdin) 3456 Expected Output Years:9 Weeks:24 Days:3 Test Case 2 Input (stdin) 5478 Expected Output Years:15 Weeks:0 Days:3 ...

Avatar

VENKATESH ATM TRANSACTIONS

Mahesh would like to withdraw X from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Mahesh account balance has enough cash to perform the withdrawal transaction (including bank charges). For each successful wit ...

Avatar

Exchange of gifts

Emily is a very popular Maths Teacher in School. She retires from her service today. Her 7th class students like her very much and they wanted to give her a grand farewell at school. The school HeadMistress is a very strict person and she didn't give ...

Avatar

Sides of a Triangle

The mathematics teacher has recently taught the formula for computing the distance between 2 points to her students. She gave them an asssignment on calculating the distance between the points. In order to prevent copying, she gave each student a dif ...

Avatar

Chemistry pH Value

In chemistry, pH (potential of hydrogen) is a numeric scale used to specify the acidity or basicity of an aqueous solution. It is approximately the negative of the base 10 logarithm of the molar concentration, measured in units of moles per liter, of ...

Avatar

REVERSE A STRING

"If an Integer N, write a program to reverse the given number. Input The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N. Output Display the reverse of the given number N. Con ...

Avatar

BASIC CALCULATOR

Write a program to simulate a basic calculator. [+,-,*,/,%]. Use switch statement. Input Format: The first line of the input consists of an integer which corresponds to a. The second line of the input consists of a character which corresponds t ...

Avatar

Black Jack

One rainy gloomy evening when all modules hid in the nearby cafes to drink hot energetic cocktails, the Hexadecimal virus decided to fly over the Mainframe to look for a Great Idea. And she has found one! Why not make her own Codeforces, with blac ...

Avatar

NUMBER PATTERN

Consider group of boys are standing in a ground. They should be stand like n*n matrix after giving the value of n.The condition is same color dress weared boys should be in same column.The boys can sit in each row who should be in diagonal.The diagon ...

Avatar

REMAINDER

Write a program to find the remainder when two given numbers are divided. he first line contains an integer T, total number of test cases. Then follow T lines, each line contains two Integers A and B. Find remainder when A is divided by B Test Cas ...

Avatar

BLACK JACK

One rainy gloomy evening when all modules hid in the nearby cafes to drink hot energetic cocktails, the Hexadecimal virus decided to fly over the Mainframe to look for a Great Idea. And she has found one! Why not make her own Codeforces, with blac ...

Avatar

IO 4

Given two cities at geographic coordinates (xA,yA) and (xB,yB), and calculate the distance between from city A to city B? Note: Use the distance between points formula dist=sqrt(pow((x2-x1),2)+pow((y2-y1),2)) Input and Output Format: Refe ...

Avatar

CONVERSION ON SPECIFIC

Write a C program to convert specified days into years, weeks and days. Test Case 1 Input (stdin) 3456 Expected Output Years:9 Weeks:24 Days:3 Test Case 2 Input (stdin) 5478 Expected Output Years:15 Weeks:0 Days:3 ...

Avatar

IO 3

Write a program to calculate the perimeter of a triangle using Heros formula Use the Following Formula: s=(a+b+c)/2area=sqrt(s*(s-a)*(s-b)*(s-c)) Input and Output Format: Refer sample input and output for formatting specification. All ...

Avatar

HOLIDAYS

"School holidays come in Berland. The holidays are going to continue for n days. The students of school No. N are having the time of their lives and the IT teacher Marina Sergeyevna, who has spent all the summer busy checking the BSE (Berland State E ...

Avatar

Mickey mouse

Mickey and Miney are two friends. Goofy was one of the Mickey's enemy.He was jealous of Mickey because Mickey was liked by everyone. One day Mickey and Miney went on to a trip. Goofy planned to kidnap Miney. He kidnapped Miney and kept her in one of ...

Avatar

NEW or OLD

When parents take their kids for Engineering Counselling, they always go with apreconceived notion that older the college, better will be the quality of education offered. There is a help desk in front of the counselling hall to tell out of the colle ...

Avatar

IO 22

Given an input as integer to the machine , he need to get the output of corresponding floating point number with five digit after decimal points. Please help him to write the program that satisfy the output. Input and Output Format: Refer sampl ...

Avatar

SQUARE ROOT

Nehas task is to find a square root for a number. Guide Neha by writing a c program in finding a square root of a number. Input: Input should contain a valid integer number. Output: Should display the square root value of a number Input Met ...

Avatar

WHO IS FIRST

Ravi and Nirmala are classmates. Nirmala will be the class topper for all the times. This time Raju tried to get more in all the subjects. The topper will be decided based on the total value. Your task task is to choose the large total value. Test ...

Avatar

IN/OUT

Ms. Sita, the faculty handling programming lab for you is very strict. Your seniors have told you that she will not allow you to enter the week's lab if you have not completed atleast half the number of problems given last week. Many of you didn't un ...

Avatar

FRIENDS AND FOES

Monk will be organising a party as he recently got a promotion. He wants to invite his childhood classmates. Monk had a total of N classmates and a lot of them were friends with each other. There used to be M1 friendship relations. However, time took ...

Avatar

IO-26

Write a program to read 10 integers. Display these numbers by printing three numbers in a line separated by commas Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to ...

Avatar

CYCLIC NUMBER

Write a C program to swap elements in cyclic order using call by reference. Test Case 1 Input (stdin) 1 2 3 Expected Output 3 1 2 Test Case 2 Input (stdin) 2 5 6 Expected Output 6 2 5 ...

Avatar

STRUCTURE POINTERS

1. Create a Structure "grocery" with following data members: a. qty - int b. price - float c. amount - float d. itemname - char 2. In main method declare structure variable as "itm" Hint: struct grocery itm 3. Create an another structure p ...

Avatar

BUBBLE SORT

Write a C program to perform bubble sort on an array of n elements. Input Format: Input consists of n+1 integers. The first integer corresponds to n, the number of elements in the array. The next n integers correspond to the elements in th ...

Avatar

POINTERS 10

Write a program to add two integers using functions use call by address technique of passing parameters and also illustrate the concept of pointer variables can be used to access the strings. Input and Output Format: Refer sample input and outp ...

Avatar

POINTERS -9

Write a program to input 10 values in an array. Categorize each value as prime or composite using pointers. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 deci ...

Avatar

POINTERS-9

Write a program to input 10 values in an array. Categorize each value as prime or composite using pointers. Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 deci ...

Avatar

RECTANGULAR MATRIX

C PROGRAM TO CALCULATE SUM OF UPPER TRIANGULAR ELEMENTS Test Case 1 Input (stdin) 3 3 1 2 3 2 1 1 1 2 1 Expected Output 6 Test Case 2 Input (stdin) 3 4 1 2 3 4 5 6 7 8 9 10 11 12 Expected Output entered ...

Avatar

SUM OF 6 NUMBERS

Print the sum of 6 numbers using array and pointers Test Case 1 Input (stdin) 1 2 3 4 5 6 Expected Output 21 Test Case 2 Input (stdin) 1 1 1 2 2 2 Expected Output 9 ...

Avatar

ARRAY PROCESSING

Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers. If the input array is empty or null, return an empty array: Test Case 1 Input (stdin) 15 1 2 3 4 5 6 7 8 9 10 -11 ...

Avatar

FIND BANDWIDTH OF MATRIX

Bandwidth of a matrix A is defined as the smallest non-negative integer K such that A(i, j) = 0 for |i - j| > K. For example, a matrix with all zeros will have its bandwith equal to zero. Similarly bandwith of diagonal matrix will also be zero. ...

Avatar

FRONT AND BACK

Rand has a task to find the sum of first and last digit of number upto given n numbers.Help him in writing C code to enter any number and find the sum of first and last digit of the number using for loop. Test Case 1 Input (stdin) 1234 Exp ...

Avatar

ARRAY PROCESSING

Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers. If the input array is empty or null, return an empty array: Test Case 1 Input (stdin) 15 1 2 3 4 5 6 7 8 9 10 -11 ...

Avatar

Chef and A Large Permutation

Today is Chef's birthday. His mom gifted him a truly lovable gift, a permutation of first N positive integers. She placed the permutation on a very long table in front of Chef and left it for him to play with it. But as there was a lot of people c ...

Avatar

ALICE IN THE WONDERLAND

Alice was bored that day,so she was sitting on the riverbank .Suddenly she notices a talking, White Rabbit with a pocket watch .It ran fast,and she followed it, down a rabbit hole .She fell into the hole and found a magical wonderland with dark trees ...

Avatar

SEMESTER HOLIDAYS

Normally in all engineering colleges, there will be long vacation after every even semester and a short vacation after every odd semester. Input format: Input consists of 1 integers which corresponds to the current semester of the students (i.e ...

Avatar

Printing next 5 numbers

A new game was introduced in a school for students of 3 standard, In which the student should tel next 5 numbers sequence from the telling number. Using union help to the students to solve it. Input Method Integer ranges from 1 to 999 Outpu ...

Avatar

RUPEE NAME

Write a program that reads the cost of an item in the form RRRR.PP (where RRRR denotes rupees and PP denotes paise) Refer sample input and output. Test Case 1 Input (stdin) 104.3 Expected Output ONE HUNDRED FOUR AND PAISE THIRTY Test C ...

Avatar

MAXIMUM ELEMENT

Display Largest Element of an array Test Case 1 Input (stdin) 5 1 2 3 4 54 Expected Output 54 Test Case 2 Input (stdin) 8 1 2 3 55 123 2 1 99 Expected Output 123 ...

Avatar

Convert zerotofive

Given a number your task is to complete the function convertFive which takes an integer n as argument and replaces all zeros in the number n with 5 .Your function should return the converted number . Test Case 1 Input (stdin) 1004 Expected ...

Avatar

RUPEE NAME

Write a program that reads the cost of an item in the form RRRR.PP (where RRRR denotes rupees and PP denotes paise) Refer sample input and output. Test Case 1 Input (stdin) 104.3 Expected Output ONE HUNDRED FOUR AND PAISE THIRTY Test C ...

Avatar

BICO GAMING

The much anticipated video game ""BiCo Grid"" has been released. The rules of ""Bico Grid"" are very simple. The game field is a 100x100 matrix, where each cell is either a blocked cell, or a cell with some number of coins. For a regular player th ...

Avatar

Sum of 2 arrays using Functions

Write a program to find the sum of the corresponding elements in 2 arrays. Input Format: Input consists of 2n+1 integers. The first integer corresponds to n , the size of the array. The next n integers correspond to the elements in the first ar ...

Avatar

STRUCTURES-1 STUDENTS DETAILS

Create a structure called Student. struct Student { char name[30]; char department[20]; int yearOfStudy; float cgpa; }; The structure variable should be "S1" Write a program to get the details of n students and to display their details ...

Avatar

STUDENT MANAGEMENT SYSTEMS

1. In this program, create a structure, "student" 2. The structure has three members: name (string), roll (integer) and marks (float). Then, a structure variable "s" is created to store information and display it on the screen. 3. Input the ...

Avatar

SIMPLE STRUCTURE

Write a C program to Store Information and Display it Using Structure Test Case 1 Input (stdin) Abi 1001 99.5 Expected Output Name=Abi Roll number=1001 Marks=99.5 Test Case 2 Input (stdin) Akash 1002 90.3 Expect ...

Avatar

POINTERS-30

Write a program which takes an input from the user and then checks whether its a number or a character . If its a character ,determine whether it is in upper case or lower case Input and Output Format: Refer sample input and output for formatti ...

Avatar

DAY AND TIME

Define a structure date containing three integers -day,months and year. Write a program using functions to read data, to validate the data entered by the user and then print the date on the screen. For example,if you enter 31/6/2007 is invalid as ...

Avatar

STRUCTURE 41

Write a program to read display add and subtract of two time variables defined using hours , minutes and seconds using typdef and passing structure variable as argument in functions. Input and Output Format: Refer sample input and output for fo ...

Avatar

SWAP 3 NUMBERS IN CYCLIC ORDER

Ramya, vidhya and Ramesh are always changing their places in cyclic manner. Can you write a code using methods(functions) to read 3 numbers and swap them using a temporary variable in a cyclic manner. Print the results in the specified order. Test ...

Avatar

DOG AND CAT

Chef is a farmer and a pet lover. He has a lot of his favorite pets cats and dogs in the barn. He does not know their exact count. But he knows that there are C cats and D dogs in the barn. Also, one day went to field and found that there were L legs ...

Avatar

SWAP 3 NUMBERS IN CYCLIC ORDER

Ramya, vidhya and Ramesh are always changing their places in cyclic manner. Can you write a code using methods(functions) to read 3 numbers and swap them using a temporary variable in a cyclic manner. Print the results in the specified order. Test ...

Avatar

APPLE VENDOR

Helen wants to find the sum of apples in 2 baskets that she is carrying to the market. You need to write a C program to help her find the total number of apples. Use functions in C to write this program. Test Case 1 Input (stdin) 2 3 Exp ...

Avatar

TIME MACHINE DIFFERENCE

The Time Machine is a science fiction novella by H. G. Wells, published in 1895 and written as a frame narrative. The work is generally credited with the popularization of the concept of time travel by using a vehicle that allows an operator to trave ...

Avatar

MULTIPLICATION TABLE

Veena telling tables to her friend saradha, for every no of saradha veena telling tables upto 5, help to her to write code to solve the task. Input Method Integer ranges from 1 to 999 Output Method Multiplication table upto 5 Test Case 1 ...

Avatar

STORE AND RETRIEVE

Store and retrieve elements from an array Test Case 1 Input (stdin) 5 10 20 30 50 40 Expected Output element 0=10 element 1=20 element 2=30 element 3=50 element 4=40 Test Case 2 Input (stdin) 4 10 20 30 40 ...

Avatar

POINTERS-24

Write a function that accepts a string using pointers. In the function ,delete all the occurrences of a given character and display the modified string on the screen Input and Output Format: Refer sample input and output for formatting specific ...

Avatar

PRINT STRING

C program to print a string using pointer Test Case 1 Input (stdin) helloworld Expected Output helloworld Test Case 2 Input (stdin) programming Expected Output programming ...

Avatar

BIGGEST OF THREE NUMBERS

Find the biggest of 3 numbers using pointer Test Case 1 Input (stdin) 23 45 10 Expected Output 45 Test Case 2 Input (stdin) 100 80 10 Expected Output 100 ...

Avatar

POINTERS 48

Write a program to reverse a string using pointer Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corresponds to input and t ...

Avatar

GO TO ROME

Rafiq trying to convert roman to numbers. He asks maths teacher to know about the conversion. His maths teacher explained the conversion of roman to numbers. Then Rafiq understands the conversion concepts, by using that he write a C program to do con ...

Avatar

LUCY

Lucy is celebrating her 15th birthday. Her father promised her that he will buy her a new computer on her birthday if she solves the question asked by him. He asks Lucy to find whether the year on which she had born is leap year or not. Help her to s ...

Avatar

IO 32

Manav had a play with his friend gourav, he gave a number that to read a floating point number and asked him to display the right most digit integral part of the number. Please help gourav to display the right most integral part of the number. Exp ...

Avatar

COMPUTING X

The cost prince of n articles is the same as the selling price of X articles . If the profit is p% then what is the value of x? Input format: The first input is an integer which corresponds to n the second is an integer which corresponds to p ...

Avatar

HEENA CHALLENGE

Heena gave a number to Jonnes and ask him to count the number of digits in a number. Sheela tries one simple logic to do that. So she decided to apply this concept in C. Test Case 1 Input (stdin) 8952 Expected Output 4 Test Case 2 ...

Avatar

MAGIC SQUARE

A magic square is an arrangement of numbers (usually integers) in a square grid, where the numbers in each row, and in each column, and the numbers in the forward and backward main diagonals, all add up to the same number Input Format: The in ...

Avatar

PRINTING NEXT

Latha and Trisha are friends. They love to play with words. Ishu gives them a task to replace each characters in a string with its next letter. Can you help them to complete this task? Test Case 1 Input (stdin) abc Expected Output bcd ...

Avatar

UPPER TRIANGULAR MATRIX

An upper triangular matrix is a square matrix in which all the elements below the diagonal are zero. That is, all the non-zero elements are in the upper triangle: Write a C program to find whether a given matrix is an upper triangular matrix or ...

Avatar

REV ARRAY

program using pointers to read in an array of integers and print its elements in reverse order Test Case 1 Input (stdin) 2 1 2 Expected Output 2 1 Test Case 2 Input (stdin) 5 1 2 6 8 5 Expected Output 5 8 6 2 1 ...

Avatar

ADDING TWO NUMBERS

Add two numbers using pointers Test Case 1 Input (stdin) 5 4 Expected Output The sum of the entered numbers is=9 Test Case 2 Input (stdin) 9 10 Expected Output The sum of the entered numbers is=19 ...

Avatar

PRINT THE GIVEN STRING

Print a string using Pointer Test Case 1 Input (stdin) Cse Expected Output Cse Test Case 2 Input (stdin) eee Expected Output eee ...

Avatar

POINTERS-5

Write a program to find Largest of three integer values using pointers Input and Output Format: Refer sample input and output for formatting specification. All float values are displayed correct to 2 decimal places. All text in bold corre ...

Avatar

PRINT STRING

C program to print a string using pointer Test Case 1 Input (stdin) helloworld Expected Output helloworld Test Case 2 Input (stdin) programming Expected Output programming ...

Avatar

CARAVAN

Most problems on CodeChef highlight chefs love for food and cooking but little is known about his love for racing sports. He is an avid Formula 1 fan. He went to watch this years Indian Grand Prix at New Delhi. He noticed that one segment of the circ ...

Avatar

CARAVAN

Most problems on CodeChef highlight chefs love for food and cooking but little is known about his love for racing sports. He is an avid Formula 1 fan. He went to watch this years Indian Grand Prix at New Delhi. He noticed that one segment of the circ ...

Avatar

POINTERS-5

A task is given to 3 persons to complete it within a particular time. If the person exceeds the time limit he will be disqualified . Only those who complete it within the given time limit is qualified. Among the qualified persons. the person who comp ...

Avatar

APPROXIMATE VALUE

Phineas and Ferb who live in the fictional town of danville ,think and do innovatively on weekends. Every day the boys embark on some grand new project, which annoys their controlling sister candace, who tries to bust them. One sunday they were bot ...

Avatar

SMALLEST PALINDROME

An integer is said to be a palindrome if its value is the same when read from both the right and left side. For a given positive Integer X , write a program that outputs the value of the smallest palindrome greater than X. Input Integer X such th ...

Avatar

GREAT CALCULATOR

SRM Students decides to create a software to extend our help to Petty shops and Shops. In this regard the "STUDENT" team has selected a few students to complete the task. The task was monitored by a group of experts and the software was tested by a e ...

Avatar

SUM OF DIGITS

" You're given an integer N. Write a program to calculate the sum of all the digits of N. Input The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N. Output Calculate the sum ...

Avatar

SUM OF SPECIFIC NUMBERS

" If Give an integer N . Write a program to obtain the sum of the first and last digit of this number. Input The first line contains an integer T, total number of test cases. Then follow T lines, each line contains an integer N. Output Displa ...

Avatar

SUM OF ODD AND EVEN NUMBERS

Write a program to find the sum of even and odd numbers in an array. Test Case 1 Input (stdin) 5 2 3 6 8 3 Expected Output even=16 odd=6 Test Case 2 Input (stdin) 4 1 3 5 7 Expected Output even=0 odd=16 ...

Avatar

ELAB FUEL BANK IN INDIA

In the United States, fuel efficiency for vehicles is normally expressed in miles-pergallon (MPG). In Canada, fuel efficiency is normally expressed in liters-per-hundred kilometers (L/100 km). Use your research skills to determine how to convert from ...

Avatar

FIBONACCI SERIES

An interesting sequence which contains a series of numbers in which each sequent number is the sum of its two previous numbers which is also called as fibonacci sequence.Write a program to generate Fibonacci sequence. Input: Enter the limit for g ...

Avatar

CHANGE CASE

program to convert upper case to lower case and lower case to upper case Test Case 1 Input (stdin) hai Expected Output HAI Test Case 2 Input (stdin) HAI Expected Output hai ...

Avatar

Month Calculator

The length of a month varies from 28 to 31 days. In this exercise you will create a program that reads the name of a month from the user as a string. Then your program should display the number of days in that month. Display 28 or 29 days for Feb ...

Avatar

VALID PERFECT SQUARE

Get a positive integer. Let N be the number of test cases.Check the number whether perfect square or not.Print TRUE when the integer is perfect square.If it is not, return FALSE.Describe it without using built-in-function.Input format: The input is v ...

Avatar

Berland University

There are N students living in the dormitory of Berland State University. Each of them sometimes wants to use the kitchen, so the head of the dormitory came up with a timetable for kitchens usage in order to avoid the conflicts: The first student ...

Avatar

YOUR NAME IS MINE

In an attempt to control the rise in population, Archer was asked to come up with a plan. This time he is targeting marriages. Archer, being as intelligent as he is, came up with the following plan: A man with name M is allowed to marry a woman wi ...