Wednesday, August 16, 2017

Java program to identify odd numbers while reading to an array

java code to calculate the distance between any two given points (x1, y1) and (x2, y2)


Problem Specification: Write a java program that calculates the distance between two given points (x1, y1) and (x2, y2). All numbers and return values should be of type double
Input: real variables x1, y1 x2 and y2
Processing: the distance is given by
Output: the distance
Algorithm:
                                              Step 1. Read the four variables x1, x2, y1 and y2 from the user.
                                              Step 2. Initialize variable     
                                              Step 3. Display the
                                              Step 4. End of program

Program Listing:

Tuesday, August 15, 2017

Change brightness of an image using matlab

The brightness function

Using the above function in matlab
Hint: image should be stored in a folder 'images'

Factorial of a number using java

Basic OSPF configuration steps

Array basics perl

Define an array (say fred) with elements 1 2 and 3.
Define another array (say barney) with elements 4 5 and 6.
Now change the array barney as (4,5,1,2,3,6) using fred.
Put number 8 before all the existing elements of barney.
So barney becomes (8,4,5,1,2,3,6)
Now add a word "last" to the array's barney.
So barney becomes (8,4,5,1,2,3,6,last)
Now assign first three values of barney into 3 different variables.
a-8, b=4 and c=5
swap a and b
Assign the value a into another variable d and, rest of the variables
into another array fred.
d=4 and fred(8,9)
Remove first element of fred into a variable e.

Coza Woza Loza

Write a program called CozaLozaWoza which prints the numbers 1 to 110, 11 numbers per line. The program shall print "Coza" in place of the numbers which are multiples of 3, "Loza" for multiples of 5, "Woza" for multiples of 7, "CozaLoza" for multiples of 3 and 5, and so on. 

The output shall look like:
1 2 Coza 4 Loza Coza Woza 8 Coza Loza 11
Coza 13 Woza CozaLoza 16 17 Coza 19 Loza CozaWoza 22
23 Coza Loza 26 Coza Woza 29 CozaLoza 31 32 Coza