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

Multiple of 5

You are given 

N inputs. Print the given inputs until you encounter a multiple of 5.

Input

The first line of input is an integer 

N. The next N lines each contain an integer as input.

Explanation

In the given example, there are 

6 inputs. 1, 2, 3, 5, 9, 6

After 

3, we have encountered 5, which is a multiple of 5.

So, the output should be 

1
2
3
Sample Input 1
6
1
2
3
5
9
6
Sample Output 1
1
2
3
Sample Input 2
5
1
2
3
4
5
Sample Output 2
1
2
3
4

First Prime Number

You are given 

N inputs. Write a program to print the first prime number in the given inputs.

Input

The first line of input is an integer 

N. The next N lines each contain an integer.

Explanation

In the given example of 

5 integers

1 
10 
4
3
2

The output should be 

3.

Sample Input 1
5
1
10
4
3
2
Sample Output 1
3
Sample Input 2
4
2
3
5
7
Sample Output 2
2

Composite Numbers in the range

You are given two integers 

M, N as input. Write a program to print all the composite numbers present in the given range (including M and N).

Input

The first line of input is an integer 

M. The second line of input is an integer N.

Explanation

In the given example, the composite numbers present in the range between 

2 to 9 are 4, 6, 8, 9.

So, the output should be

4
6
8
9
Sample Input 1
2
9
Sample Output 1
4
6
8
9
Sample Input 2
1
4
Sample Output 2
4

W pattern with *

Write a program to print 

W pattern of N lines using an asterisk(*) character as shown below.

Note: There is a space after each asterisk * character.

Input

The first line is an integer 

N.

Explanation

For 

N = 5

The output should be

* * * * * * * * * 
 * * * * * * * * 
  * * *   * * * 
   * *     * * 
    *       *
Sample Input 1
5
Sample Output 1
* * * * * * * * * 
 * * * * * * * * 
  * * *   * * * 
   * *     * * 
    *       *
Sample Input 2
4
Sample Output 2
* * * * * * * 
 * * * * * * 
  * *   * * 
   *     *

Armstrong numbers between two intervals

Write a program to print all the Armstrong numbers in the given range 

A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.

Input

The first line has an integer 

A. The second line has an integer B.

Output

Print all Armstrong numbers separated by a space.
If there are no Armstrong numbers in the given range, print 

-1.

Explanation

For 

A = 150 and B = 200

For example, if we take number 153, the sum of the cube of digits 

1, 5, 3 is

 13 + 53 + 33 = 153.

So, the output should be 

153.

Sample Input 1
150
200
Sample Output 1
153
Sample Input 2
1
3
Sample Output 2
1 2 3

Pyramid

Given an integer 

N, write a program to print a pyramid of N rows as shown below.

Input

The first line of input is an integer 

N.

Explanation

In the example, the number of rows in the pyramid is 

5.

So, the output should be

. . . . 0 . . . . 
. . . 0 0 0 . . . 
. . 0 0 0 0 0 . . 
. 0 0 0 0 0 0 0 . 
0 0 0 0 0 0 0 0 0
Sample Input 1
5
Sample Output 1
. . . . 0 . . . . 
. . . 0 0 0 . . . 
. . 0 0 0 0 0 . . 
. 0 0 0 0 0 0 0 . 
0 0 0 0 0 0 0 0 0
Sample Input 2
6
Sample Output 2
. . . . . 0 . . . . . 
. . . . 0 0 0 . . . . 
. . . 0 0 0 0 0 . . . 
. . 0 0 0 0 0 0 0 . . 
. 0 0 0 0 0 0 0 0 0 . 
0 0 0 0 0 0 0 0 0 0 0

Draw a class diagram and use case diagram for suppliers of building construction . Write down all the methodclass.

example: getname()


The four branches of a bakery in new York made sales(in millions us dollars). As shown below

A 1.13 1.71 1.39 1.68 1.74 1.19 1.15 1.36

B 1.34 1.47 1.74 1.53 1.74 1.19 1.15 1.36

C 1.15 1.33 1.01 1.28 1.20 1.59 1.59 1.68

D 1.03 1.68 1.78 1.51 1.23 1.91 1.34 1.82

Write a well commented program in R that uses the data to compute the following parameter estimates


a) CS =(( (n1-1)s21 +(n2-1)s22 +(n3-1)s23 +(n4-1)s24)/(n1+n2+n3+n4-4))1/2


b)CM= (n1x1+n2x2+n3x3+n4x4)/(n1+n2+n3+n4)

where

ni =sample size for the ith branch

xi =sample mean for the ith branch

s2i=sample variance for the ith branch

i=1,2,3,4



Zaid is an IT expert in a medical company that works on brain tumor detection. Zaid needs to transform the brain image scanned through monochromic camera for image analyses.

 What will you suggest Zaid from 2D transformation and 3D transformation of monochrome image in the transformation process? Discuss it with solid reason.



StudentAccount

      

     -studentName: String

     -studentCourse: String

     -balance: double

      

     +StudentAccount()

     +StudentAccount(String,String,double)

     +getters()

     +setters()

     +toString(): String

     +pay(double): double

     +addFees(double): double

     +refund(): void



Code the StudentAccount class according to the class diagram


LATEST TUTORIALS
APPROVED BY CLIENTS