Practical Assignment - 1


Atmiya Institute of Technology & Science
Department of M.C.A.

M.C.A. Semester - III
630006 – Programming Skill – IV (JAVA)
Practical Assignment – 1
Date :  06 / 08 / 2010
--------------------------------------------------------------------------------------------------------
1).write a program to find  AVERAGE of  3 byte type variable .
2).write a program to find  sum of  5 short type variable .
3).Write a program to perform different bit wise operations
4.Write a java program that will compute the amount of interest that is earned on an investment over a period of 5 years.  The value of the investment at the end of each year is output.
5). Write a program to convert Fahrenheit to Celsius. The formula for the conversion is as follows:  Celsius =( 5 / 9 ) * ( Fahrenheit – 32 )
6). Print out the alphabet and ascii value on one line of output.
          e.g. A 65 B 66 C 67….Z 90     
7). Write a program that displays the divisors of number, and then it prints the result.
8). Write a program to find primes nos. from 2 to 100.
9). Write program in java to generate following output. Use Command line argument for this. (Hint : Accept N number from user on command line)
                 *
              *      *
          *      *      *
       *     *      *      *
          *      *      *
              *     *
                 *
        *
        *    *
        *    *    *
        *    *    *     *
        *    *    *
        *    *
        *
     1 2 3 4 5 1 2 3 4 5
     1 2 3 4       2 3 4 5
     1 2 3             3 4 5
     1 2                   4 5
     1                         5
     1 2                   4 5
     1 2 3             3 4 5
     1 2 3 4       2 3 4 5
     1 2 3 4 5 1 2 3 4 5



               *
           *   *   *
               *

(Input : 3)

10). Write a simple java application to print a pyramid. The first line has one character, 2nd line has two characters and so on. The character to be used in the pyramid is taken as a command line argument.

A) Input    :    PARAG
    Output  : 

                   P
                   P        A
                   P        A       R
                   P        A       R       A
                   P        A       R       A       G

B) Input :  PARAG
         
                         P
                   A           A  
               R                   R
            A                          A
        G                                 G
           A                           A
               R                   R        
                   A          A   
                         P 

        

0 comments:

Post a Comment