Skip to content

Commit 9e9d41a

Browse files
authored
Add files via upload
1 parent 8f497f9 commit 9e9d41a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1472
-0
lines changed

Ascii.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.*;
2+
class Ascii{
3+
4+
public static void main(String args[])
5+
{
6+
7+
Scanner in = new Scanner(System.in);
8+
9+
10+
for(int k=0;k<=255;k++)
11+
{
12+
System.out.println("\n The ascii value of " +(char)k +" is " +k);
13+
}
14+
15+
//return 0;
16+
}
17+
}

AvgFunction.java

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
class AvgFunction
3+
{
4+
public static void Average(int a,int b,int c)
5+
{
6+
float Avg = (a+b+c)/3;
7+
System.out.println("Average of given number : " +Avg);
8+
9+
return;
10+
}
11+
public static void main(String [] args)
12+
{
13+
Scanner in = new Scanner(System.in);
14+
15+
System.out.println("Enter any three number");
16+
17+
int a=in.nextInt();
18+
int b=in.nextInt();
19+
int c=in.nextInt();
20+
21+
Average(a,b,c);
22+
23+
}
24+
}

BinaryNoPattern.java

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.*;
2+
class BinaryNoPattern
3+
{
4+
public static void main(String [] args)
5+
{
6+
Scanner in = new Scanner (System.in);
7+
int i,j,n;
8+
System.out.println("Enter any Number");
9+
n=in.nextInt();
10+
for(i=1;i<=n;i++)
11+
{
12+
for(j=1;j<=i;j++)
13+
{
14+
if((i+j)%2==0)
15+
{
16+
System.out.print(1 +" ");
17+
}else{
18+
System.out.print(0 +" ");
19+
}
20+
21+
}
22+
23+
System.out.println();
24+
}
25+
}
26+
}

Calculator.java

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import java.util.*;
2+
class Calculator{
3+
4+
public static void main(String args[])
5+
{
6+
7+
Scanner in = new Scanner(System.in);
8+
float no1,no2,add,sub,mul,div,total,avg;
9+
int ch;
10+
11+
do
12+
{
13+
System.out.println("Enter Number 1 and Number 2 : ");
14+
no1=in.nextFloat();
15+
no2=in.nextFloat();
16+
17+
System.out.println("Enter your choise :\n1.Addition\n2.Substraction \n3.Multiplication \n4.Division \n5.Total \n6.Average");
18+
ch=in.nextInt();
19+
20+
21+
22+
switch(ch)
23+
{
24+
25+
26+
case 1:
27+
add=no1+no2;
28+
System.out.println("Addition = "+add);
29+
break;
30+
31+
case 2:
32+
sub=no1+-no2;
33+
System.out.println("Substraction = "+sub);
34+
break;
35+
36+
case 3:
37+
mul=no1*no2;
38+
System.out.println("Multiplication = "+mul);
39+
break;
40+
41+
case 4:
42+
div=no1/no2;
43+
System.out.println("Division = "+div);
44+
break;
45+
46+
47+
case 5:
48+
total=no1+no2;
49+
System.out.println("Total = "+total);
50+
break;
51+
52+
case 6:
53+
avg=(no1+no2)/2;
54+
System.out.println("Average = "+avg);
55+
break;
56+
default:
57+
System.out.println("Cannot find case");
58+
59+
}
60+
}while(ch!=0);
61+
62+
}
63+
64+
}
65+
66+
67+
68+
69+
70+
71+

CircumferenceFunction.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.*;
2+
class CircumferenceFunction
3+
{
4+
public static double CircumferenceCircle(float radii)
5+
{
6+
double CircumCircle=2*3.14*radii;
7+
System.out.println("Circumference of Circle = " +CircumCircle);
8+
9+
return(CircumCircle);
10+
}
11+
public static void main(String [] args)
12+
{
13+
Scanner in = new Scanner(System.in);
14+
System.out.println("Enter radius of circle");
15+
16+
float radii = in.nextFloat();
17+
18+
CircumferenceCircle(radii);
19+
}
20+
}

CountFunction.java

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import java.util.*;
2+
class CountFunction
3+
{
4+
public static void CountNo(int num)
5+
{
6+
7+
if(num>0)
8+
{
9+
System.out.println("Numbers are positive" +num++);
10+
11+
}else{
12+
if(num<0)
13+
{
14+
System.out.println("Numbers are negative" +num++);
15+
16+
}else{
17+
18+
System.out.println("Number are zero : " +num++);
19+
}
20+
}
21+
22+
return;
23+
}
24+
25+
public static void main(String [] args)
26+
{
27+
Scanner in = new Scanner (System.in);
28+
System.out.println("Enter 1 to continue and 0 to stop");
29+
30+
int input = in.nextInt();
31+
32+
if(input ==1)
33+
{
34+
System.out.println("Enter any number : ");
35+
int num=in.nextInt();
36+
CountNo(num);
37+
}else{
38+
System.out.println("Thank You !!");
39+
}
40+
41+
}
42+
}

Demo.java

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import java.util.*;
2+
class Demo{
3+
4+
public static void main(String args[])
5+
{
6+
7+
Scanner in = new Scanner(System.in);
8+
float no1,no2,add,sub,mul,div,total,avg;
9+
int ch;
10+
11+
do
12+
{
13+
System.out.println("Enter Number 1 and Number 2 : ");
14+
no1=in.nextFloat();
15+
no2=in.nextFloat();
16+
17+
System.out.println("Enter your choise :\n1.Addition\n2.Substraction \n3.Multiplication \n4.Division \n5.Total \n6.Average");
18+
ch=in.nextInt();
19+
20+
21+
22+
switch(ch)
23+
{
24+
25+
26+
case 1:
27+
add=no1+no2;
28+
System.out.println("Addition = "+add);
29+
break;
30+
31+
case 2:
32+
sub=no1+-no2;
33+
System.out.println("Substraction = "+sub);
34+
break;
35+
36+
case 3:
37+
mul=no1*no2;
38+
System.out.println("Multiplication = "+mul);
39+
break;
40+
41+
case 4:
42+
div=no1/no2;
43+
System.out.println("Division = "+div);
44+
break;
45+
46+
47+
case 5:
48+
total=no1+no2;
49+
System.out.println("Total = "+total);
50+
break;
51+
52+
case 6:
53+
avg=(no1+no2)/2;
54+
System.out.println("Average = "+avg);
55+
break;
56+
default:
57+
System.out.println("Cannot find case");
58+
59+
}
60+
}while(ch!=0);
61+
62+
}
63+
64+
}
65+
66+
67+
68+
69+
70+
71+

Divisibility.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.*;
2+
class Divisibility
3+
{
4+
public static void main(String []args)
5+
{
6+
Scanner in = new Scanner(System.in);
7+
int n , i;
8+
System.out.println("Enter any number");
9+
n = in.nextInt();
10+
for(i=1;i<=100;i++)
11+
{
12+
if(i%n==0)
13+
System.out.println(i);
14+
}
15+
}
16+
}

DoHello.java

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import java.util.*;
2+
class DoHello
3+
{
4+
public static void main(String [] args)
5+
{
6+
int i=1;
7+
do{
8+
System.out.println("Hello World");
9+
i++;
10+
}while(i<5);
11+
}
12+
}

FactorealFunction.java

Whitespace-only changes.

Factorial.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.*;
2+
class Factorial
3+
{
4+
public static void main(String[]args)
5+
{
6+
Scanner in = new Scanner(System.in);
7+
int i, n, fact=1;
8+
System.out.println("Enter any number");
9+
n=in.nextInt();
10+
for(i=1; i<=n;i++)
11+
{
12+
fact = fact*i;
13+
}
14+
System.out.println(fact);
15+
}
16+
}

FactorialFunction.java

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import java.util.*;
2+
class FactorialFunction
3+
{
4+
public static void Factorial(int n)
5+
{
6+
if(n<0)
7+
{
8+
System.out.println("Invalid Number");
9+
return;
10+
}
11+
int fact=1;
12+
for(int i=n;i>=1;i--)
13+
{
14+
fact=fact*i;
15+
}
16+
System.out.println(fact);
17+
return;
18+
}
19+
public static void main(String[] args)
20+
{
21+
Scanner in = new Scanner(System.in);
22+
System.out.println("Enter any number");
23+
int n = in.nextInt();
24+
25+
Factorial(n);
26+
}
27+
28+
}

0 commit comments

Comments
 (0)