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 matrix of order M*N and a value K, write a program to rotate each ring of the matrix clockwise by K elements. If in any ring has less than or equal to K elements, then don’t rotate that ring.Input


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

next M lines will contain N space-separated integers.

next line will contain an integer, denoting K.Output


output should be M*N matrix by rotating the matrix by K elements.Explanation


For example, if the given M and N are 4 and 4 respectively.matrix elements are

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

If the given K is 3. Rotate each ring of the matrix by 3 elements.

In the above matrix, the elements (1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5) is a ring, similarly, the elements (6, 7, 11, 10) will make a ring.

Therefore, by rotating each ring in clockwise direction by 3 elements will give (13, 9, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14) and (10, 6, 7, 11). output should be

13 9 5 1

14 7 11 2

15 6 10 3

16 12 8 4


Write a program to print the anti-diagonal elements in the given matrix.Input


The first line of input will contain an integer N, denoting the number of rows and columns of the input matrix.

The next N following lines will contain N space-separated integers, denoting the elements of each row of the matrix.Output


The output should be a list containing the anti-diagonal elements.Explanation


For example, if the given N is 3, and the given matrix is

1 2 3
4 5 6
7 8 9

The anti diagonal elements of the above matrix are 3, 5, 7. So the output should be the list

[3, 5, 7]

Sample Input 1

3

1 2 3

4 5 6

7 8 9

Sample Output 1

[3, 5, 7]

Sample Input 2

5

44 71 46 2 15

97 21 41 69 18

78 62 77 46 63

16 92 86 21 52

71 90 86 17 96

Sample Output 2

[15, 69, 77, 92, 71]


Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.Input


The input will contain space-separated integers, denoting the elements of the list.Output


The output should be an integer.Explanation


For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,

[2]
[2, -4]
[2, -4, 5]
[2, -4, 5, -1]
[2, -4, 5, -1, 2]
[2, -4, 5, -1, 2, -3]
[-4]
[-4, 5]
[-4, 5, -1]
[-4, 5, -1, 2]
[-4, 5, -1, 2, -3]
[5]
[5, -1]
[5, -1, 2]
[5, -1, 2, -3]
[-1]
[-1, 2]
[-1, 2, -3]
[2]
[2, -3]
[-3]

Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.

Sample Input 1

2 -4 5 -1 2 -3

Sample Output 1

6

Sample Input 2

-2 -3 4 -1 -2 1 5 -3

Sample Output 2

7


Create an array of int called temperatures with 7 elements.

Initialize the array with the following values:

30, 31, 60, 65, 75, 71, 112


Create a void function called calculateTemps which takes in the array of temperatures.  It will also take in three variables of type double which are passed by reference and are named highestavg, and numTempsFreezing.  In the body, this function will calculate the three values based on the array

1)    The highest temperature

2)    The average temperature

3)    The number of temperatures at or below 32 (freezing in Fahrenheit)

And these values will be assigned to the corresponding variables.


From main, call the function calculateTemps and display the three values which are the highest  and average temperatures and also the number of temperatures below freezing of the provided array as determined by the function.


Write a function called calculateChange with total change amount as an integer input and returns the change using the fewest coins. The coin types are dollars, quarters, dimes, nickels, and pennies.


Write a function called calculateChange that takes six parameters all of type integer: change dollars as pass by reference, quarters as pass by reference, dimes as pass by reference, nickels as pass by reference, pennies as pass by reference,


Ensure the arguments are in that order. The function calculates the correct number of each coin type using the fewest coins and returns these via the pass by reference parameters.


The main function of the program inputs the change amount, calls the function and then displays the number for each coin with one coin type per line.


Example sessions:


2933

Dollars: 29

Quarters: 1

Dimes: 0

Nickels: 1

Pennies: 3


Follow the specification carefully. As stated above, make sure to use "integer" as the data type for the variables.


Write a c++ program that use a whole loop to perform the following tasks?

 ‐Prompt to accept two number 

display all odd numbers between the numbers

- display the sun of all even number between the number

-output the number and its square for all number between the give number

  • - out put the sum of the square if the odd number b/n the number

Write a program that works with fractions. Your program should be able to add,

subtract, multiply, and divide two fractions. Write a separate function for addition,

subtraction, multiplication and division. Specifically, your program must request

two fractions from the user, getting the numerator and denominator separately for

each fraction, and the operation to perform (add, subtract, multiply, or divide).

Your program will then compute the resulting fraction, keeping the numerator and

denominator separate, and output the result.

Note:

Make the structure for fractions. Then declare variable of fractions and use

them for addition and multiplication etc....



Create a class Android_Device. The data members of the class are IMEIno (int), Type (String), Make (String), Modelno (int), Memory(float), Operating_System(String). Then Implement member functions to:

1. Set the values of all data members.

2. Display the values of all data members


You are required to create your personal blog. The blog should contain four (4) main pages 

which should reflect the pictures below. With screen shots of each page shown below. Your 

content should exactly be aligned as it appears in the pictures. 2. The Main Page – Index 

Within your main page, provide the content that defines your blog, discuss what it is about. 

 

 

3. The Logo Page 

Within your Logo page, provide the logo for your company and give its description        As to what it reflects. 

 

 

 

 

4. The Gallery Page 

   Within gallery page, provide the best possible images of your brand. 

 

 

5. The Contact Us Page 

   Within your contact us page, please provide the best sign-up form and sign – form  where 

you will be contacted by your followers. 

 


Which one of the following keywords is used to for a friend function?


a.friend_func


b.Friend


c.friend


d.Friend_func



LATEST TUTORIALS
APPROVED BY CLIENTS