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

 The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i


Note:


Return -1 if the array is null

Return 0 if the total amount of food from all houses is not sufficient for all the rats.

Computed values lie within the integer range.

Example:


Input:


r: 7

unit: 2

n: 8

arr: 2 8 3 5 7 4 1 2

Output:


4


Explanation:


Total amount of food required for all rats = r * unit

= 7 * 2 = 14.


The amount of food in the 1st 4 houses = 2+8+3+5 = 18. Since, amount of food in 1st 4 houses is sufficient for all the rats. Thus, output is 4.


take a function to check no is prime or not from array and then is number is prime add 1 to element if not then multiply by 2..note: Use arrow function to add or multiply element part


Pls help me to implement this program





#include <iostream>



using namespace





struct NameType



{





string first;



string middle;



string last;





};





struct AddressType



{





string address1;



string address2;



string city;



string state;



string zip;





};





struct DateType



{





int month;



int day;



int year;





};





struct ContactType



{





string phone;



string cellphone;



string fax;



string pager;



string email;





};





struct EmployeeType



{





NameType name;



string emp_id;



AddressType address;



DateType hireDate;



DateType quitDate;



ContactType contact;





};




What is h(41)-h(40), given the definition of h below?

def h(n):
    s = 0
    for i in range(1,n+1):
        if n%i > 0:
           s = s+1
    return(s)







Create a Python script which will accept a positive integer and will display the DIVISORS of the input number.


Sample Output:

Input a Positive Integer : 20

The DIVISORS of 20 are...

1 2 4 5 10 20


I need the code to have an output stated above.


Create a Python script which will accept a positive integer (n) and any character then it will display the input character n times.

Sample Output:

Positive Integer (n) : 7 Input any Character : A AAAAAAA


I need the code to have an output stated above.


print multiples of 3 in given N numbers


print 9 number with help of "*"


Create a Python script which will accept two positive integers where the first number would be the start of a range and the second number would be the end of a range. Then the application will determine the sum of all EVEN numbers and sum of all ODD numbers from the given range.


Sample Output:

Start of a Range: 5

End of a Range: 10

Sum of Even nos. is 24

Sum of Odd nos. is 21


I need the code to have an output stated above.


Write a python function that accepts a list of numbers and try to find out the value of a ‘magic index’. The ‘magic index’ is calculated as the ratio of the largest and smallest list element. The python function Magic_Index(A) (Refer RollNo_W10B_1.py)Take a list of elements and return the value of the magic index or error message for any possible exceptions. The error message will be "error occurred = error name".

LATEST TUTORIALS
APPROVED BY CLIENTS