Write a program that print your name and your grade in a new line.
Write a program that take two integers from the user and print the results of this equation:
Result = ((num1 + num2) * 3) – 10
Write a program that print the relation between two integer number if those numbers are equal, not equal and which one contain the higher value.
Math Quiz
Write a program to print the following,
Sample Input 1
1 3 4 5 6
5
3 5
Sample Output1
12
Ordered Matrix
Given a M x N matrix, write a program to print the matrix after ordering all the elements of the matrix in increasing order.
Input
The first line of input will contain two space-separated integers, denoting the M and N.
The next M following lines will contain N space-separated integers, denoting the elements of each list.
Output
The output should be M lines containing the ordered matrix.
Note: There is a space at the end of each line.
Explanation
For example, if the given M is 3 and N is 3, read the inputs in the next three lines if the numbers given in the next three lines are the following.
1 20 3
30 10 2
5 11 15
By ordering all the elements of the matrix in increasing order, the ordered matrix should be
1 2 3
5 10 11
15 20 30
Sample Input 1
3 3
1 20 3
30 10 2
5 11 15
Sample Output 1
1 2 3
5 10 11
15 20 30
Sample Input 2
2 5
-50 20 3 25 -20
88 17 38 72 -10
Sample Output 2
-50 -20 -10 3 17
20 25 38 72 88
Prompt the user to enter the four assessments (Class & Cycle tests) and set the object using the setValues method
Sum of Non-Diagonals
As the creative content member of your newspaper company, you are given the task to publish a puzzle in your local newspaper. For a given MxM integer matrix, the task is to print the sum of all elements other than the diagonal elements,Both the diagonals are to be excluded.
Input
The first line of input is a positive integer M.
The next M lines of input contain M space-separated integers.
Output
The output is an integer that represents the sum of all the numbers in the matrix as mentioned above.
Sample Input1
3
4 1 3
2 5 6
1 2 3
Sample Output1
11
Sample Input2
5
1 2 2 3 3
4 4 5 6 7
9 8 7 6 5
9 2 3 8 8
-4 -2 -2 4 -7
Sample Output2
63
Friend and Enemy
A group of F friends went to a haunted house.Each member was given a shirt with a number on it ranging from 1 to F. As they entered the haunted house, one of them was kidnapped and an enemy joined them.But unfortunately, the enemy didn't wear the shirt with the same number as the kidnapped one, instead wore the same as some other person.Find the numbers on the shirts of the enemy and the kidnapped person.
Input
The input is a single line containing space-separated positive integers from 1 to F.
Output
The output should be a single line containing the shirt numbers of the enemy and kidnapped person separated by a space.
Explanation
The given array is 3 1 5 2 1
In the range from 1 to 5, the number 1 has occured twice and 4 is the missing number. So, 1 belongs to the enemy's shirt, and 4 belongs to kidnapped.Hence, the output should be 1 4.
Sample Input1
3 1 5 2 1
Sample Output1
1 4
Sample Input2
1 2 2 4
Sample Output2
2 3
Strict Sentence
A sentence is called Strict sentence if it contains all unique words.You can make a sentence strict by removing some words from it such that all remaining words are unique.
You are given a sentence S. You need to write a program to make it strict and print the longest strict sentence possible(Order of words in the given sentence should be preserved).
Note: Words are case-insensitive. For example, Apple, apple, aPPle etc.. are considered the same word.
Input
The first line contains a string S.
Output
The output contains a string which is the longest strict sentence possible.
Explanation
For S = my name is usha my native place is hyderabad.
my and is are not unique words.After removing my and is, the longest possible strict sentence is my name is usha native place hyderabad. So the output should be my name is usha native place hyderabad.
Sample Input1
my name is usha my native place is hyderabad
Sample Output1
my name is usha native place hyderabad
The purpose of this problem is to write some small functions and practice passing things around amoung functions.
1) The main function shall ask the user to enter three numbers and read the three numbers.
2) Write a function named findSum that takes three numbers as arguments and returns their sum. The main function shall call this function.
3) Write a function named findAverage that takes the sum and the number of numbers and returns the average. The main function shall call this function.
4) Write a function named findSmallest that takes the three numbers and returns the smallest value. The main function shall call this function.
5) The main function shall print the results in the following format, with two decimal positions and the decimal points aligned:
Results:
First number 17.23
Second number 3.98
Third number 22.32
Total 43.53
Average 14.51
Smallest 3.98
Test the program twice with the following two sets of numbers:
37.144 2.4144 19
4.23 5.78 6.21