Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Given a string, write a program to return the sum and average of the numbers that appear in the string, ignoring all other characters.Input


The input will be a single line containing a string.Output


The output should contain the sum and average of the numbers that appear in the string.

Note: Round the average value to two decimal places.Explanation


For example, if the given string is "I am 25 years and 10 months old", the numbers are 25, 10. Your code should print the sum of the numbers(35) and the average of the numbers(17.5) in the new line.

Sample Input 1

I am 25 years and 10 months old

Sample Output 1

35

17.5

Sample Input 2

Tech Foundation 35567

Sample Output 2

35567

35567.0





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


Smallest Missing Number

Given a list of numbers, write a program to print the smallest positive integer missing in the given numbers.Input


The input will be a single line containing numbers separated by space.Output


The output should be a single line containing the smallest missing number from given numbers.Explanation


For example, if the input numbers are 3, 1, 2, 5, 3, 7, 7.

The number 1, 2, 3 are present. But the number 4 is not. So 4 is the smallest positive integers that is missing from the given numbers.

Sample Input 1

3 1 2 5 3 7 7

Sample Output 1

4

Sample Input 2

5 5 2 3 1 8 8 4

Sample Output 2

6




Write program to input a multi-word string from keyboard and write this input string along with first letter of each of its word into a file “initials.txt”. Data already present in the file initials.txt must be preseved. Display suitable error message if the file opening/writing operation fails. 


Given two arrays A[n] & B[n] containing bit strings representing sets A & B respectively, write a code fragment to construct bit string representing the set A⨁B.


Given three arrays A[n], B[n] & C[n] containing bit strings representing sets A, B & C respectively, write a code fragment to determine whether (̅A∩ B) ⊂ ̅C.


Number to English Words

Write a program to convert a non-negative integer

N to its English words representation.Input

The input will be a single line containing an integer

N. Note: The input number will not be greater than 1010.Output

The output should be a single line containing the representation of the English words of number

N. See the sample input and output for the English words of numbers in places.Explanation

For example, if the given number is 123, your code should print the English words representation, which is

One Hundred Twenty Three

Sample Input 1

123

Sample Output 1

One Hundred Twenty Three

Sample Input 2

10005

Sample Output 2

Ten Thousand Five

Sample Input 3

1234567891

Sample Output 3

One Billion Two Hundred Thirty Four Million Five Hundred Sixty Seven Thousand Eight Hundred Ninety One




Area of Rectangle

Given an MxN matrix filled with

X's and O's, find the largest rectangle containing only X's and return its area. If there are no Xs in the entire matrix print 0.Input

The first line of input will be containing two space-separated integers, denoting M and N.

The next M lines will contain N space-separated integers, denoting the elements of the matrix.

Output

The output should be a single line containing the area of the maximum rectangle.

Explanation

For example, if the given M, N and elements of matrix are as the following


4 5

X O X O O

X O X X X

X X X X X

X O O X O


The matrix from indices (1, 2) to (2, 4) has the maximum rectangle with

X. So the output should be the area of the maximum rectangle with X, which is 6.

Sample Input 1

4 5

X O X O O

X O X X X

X X X X X

X O O X O

Sample Output 1

6

Sample Input 2

3 3

O X X

O X X

O O O

Sample Output 2

4



Rotate Words In Sentence

Given a sentence and an integer N, write a program to rotate letters of the sentence among the words without changing the length of those words and positions of the spaces.

Input

The first line of input will be a sentence.

The second line of input will be an integer N.

Output

The output should be a single line containing the sentence by rotating the letters among the words without changing the length of the words and positions of the spaces.

Explanation

For example, if the given sentence and N are


Welcome to your first problem

5


Rotate the sentence 5 letters towards right side without changing the length of the words and position of spaces in the original sentence.

So the output should be

oblemWe lc omet oyour firstpr

Sample Input 1

Welcome to your first problem

5

Sample Output 1

oblemWe lc omet oyour firstpr

Sample Input 2

All the best

2

Sample Output 2

stA llt hebe




#1. Write a simple c++ program in to calculate the area of a regular hexagon.

#2. Write a program to compute the following mathematical equation to find the value of Y;

Y= 4x3 + 8x2 + 9x-19 over(÷) |7-x3| + square root of 3x2 +19


LATEST TUTORIALS
APPROVED BY CLIENTS