Saturday, December 24, 2022

Write a Program to Calculate a Series like 1/1! + 2/2! +. …. + 10/10!

class series {

public static void main(String args[]){
double sum = 0;
for(int i=1;i<=10;i++){
double fact =1, cal=0;
for(int j=1;j<=i;j++){
fact*=j;
}
cal = i/fact;
System.out.print(cal+" ");
sum = sum+cal;

}
System.out.println();
System.out.println("\nThe Sum is : "+sum+"  ");
}
}
OUTPUT :-
1.0 1.0 0.5 0.16666666666666666 0.041666666666666664 0.008333333333333333 0.001388888888888889 1.984126984126984E-4 2.48015873015873E-5 2.7557319223985893E-6

The Sum is : 2.7182815255731922

Wednesday, December 21, 2022

Print Table

 class printTable{

public static void main(String args[]){

int n = Integer.parseInt(args[0]);

for(int i=1;i<=10;i++){

System.out.println(n + " * " + i+" = "+i*n);

}

}

}

OUTPUT :-

javac printTable.java // For Compile

java printTable 5 // For Run

5 * 1 = 5

5 * 2 = 10

5 * 3 = 15

5 * 4 = 20

5 * 5 = 25

5 * 6 = 30

5 * 7 = 35

5 * 8 = 40

5 * 9 = 45

5 * 10 = 50

More Java Programs

What is Java?


         Java is a high-level Programming Language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

->According to SUN, 3 billion devices run java. There are many devices where java is currently used. Some of them are as follows:

    Desktop Applications such as acrobat reader, media player, antivirus etc.

    Web Applications such as irctc.co.in, javatpoint.com etc.

    Enterprise Applications such as banking applications.

    Mobile & Embedded System

    Smart Card

    Robotics and Games etc.

 MORE ABOUT JAVA


JAVA PRACTICAL

Write a Program to print hello wordl!

# include <stdio.h>

int main()

{

    printf("Welcome to the World of C Programming.");

    return 0;

}


MORE PROGRAMS OF C LANGUAGE



Tuesday, December 20, 2022

What is program? What is programming language?

 Program :-

        A computer program is a sequence of instructions for performing a task designed to solve specific problems.

        A computer program is a list of instructions that tell a computer what to do. Everything a computer does is done by using a computer program. A computer program is written in a programming language.

Programming Language

        A set of words, symbols and codes used to write programs is called programming language.

        With the help of programming language, a programmer tells a computer what to do. Some popular computer programming languages are C, C++, Java etc.


MORE ABOUT PROGRAMMING