Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

NIL GADHIYA Practical 1 23SE02IE068(CSE)

Class - CSE-3B Batch - C

Aim 1 : Write a simple "Hello, World!" program in Java to understand the


basic structure and syntax.

Input :

public class nil {

public static void main(String[] args) {

System.out.println("Hello world!");

Output :
NIL GADHIYA Practical 1 23SE02IE068(CSE)
Class - CSE-3B Batch - C

Aim 2 : Write a Java program to print the value of different datatypes.

Input :
class datatypes {

public static void main(String args[])

int num;

float b;

char c;

String s;

num = 20;

b = 1.21f;

c = 'N';

s = "Nil Gadhiya";

System.out.println("Value of num: "+num);

System.out.println("Value of b: "+b);

System.out.println("Value of c: "+c);

System.out.println("Value of s: "+s);

Output :
NIL GADHIYA Practical 1 23SE02IE068(CSE)
Class - CSE-3B Batch - C

Aim 3 : Write a java program to perform arithmetic operations on integers.

Input :

class ArithmeticOperation

public static void main(String[]args)

int a=25,b=10; int


sum=a+b; int product
=a*b; int difference=a-
b; float quotient=a/b;
float remainder =a%b;

System.out.println("The Value of Sum = "+sum);

System.out.println("The Value of product = "+product);

System.out.println("The Value of difference = "+difference);

System.out.println("The Value of quotient = "+quotient);

System.out.println("The Value of remainder = "+remainder);

Output :

You might also like