Skip to content

Commit 5f75af5

Browse files
Add files via upload
1 parent dad6f27 commit 5f75af5

Some content is hidden

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

62 files changed

+901
-0
lines changed

Diff for: addmat.class

1.83 KB
Binary file not shown.

Diff for: addmat.java

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import java.util.*;
2+
class addmat
3+
{
4+
public static void main(String args[])
5+
{
6+
int a[][] = new int[10][10];
7+
int b[][] = new int[10][10];
8+
int c[][] = new int[10][10];
9+
Scanner obj = new Scanner(System.in);
10+
System.out.println("how many row in martix a");
11+
int r1 = obj.nextInt();
12+
System.out.println("how many coln in matrix a");
13+
int c1 = obj.nextInt();
14+
15+
System.out.println("how many row in ");
16+
int r2 = obj.nextInt();
17+
System.out.println("how many coln");
18+
int c2 = obj.nextInt();
19+
if(r1==c2)
20+
{
21+
22+
System.out.println("enter the elements into the array a");
23+
for(int i=0;i<r1;i++)
24+
for(int j=0;j<c1;j++)
25+
a[i][j] = obj.nextInt();
26+
27+
System.out.println("enter the elements into the array b");
28+
for(int i=0;i<r1;i++)
29+
for(int j=0;j<c1;j++)
30+
b[i][j] = obj.nextInt();
31+
32+
System.out.println("matrix a");
33+
for(int i=0;i<r1;i++)
34+
{
35+
System.out.println();
36+
for(int j=0;j<c1;j++)
37+
System.out.print(a[i][j]+" ");
38+
}
39+
40+
System.out.println("matrix b");
41+
for(int i=0;i<r1;i++)
42+
{
43+
System.out.println();
44+
for(int j=0;j<c1;j++)
45+
System.out.print(b[i][j]+" ");
46+
}
47+
48+
for(int i=0;i<r1;i++)
49+
for(int j=0;j<c1;j++)
50+
c[i][j] =a[i][j]+b[i][j];
51+
System.out.println("matrix a+b");
52+
for(int i=0;i<r1;i++)
53+
{
54+
System.out.println();
55+
for(int j=0;j<c1;j++)
56+
System.out.print(c[i][j]+" ");
57+
}
58+
}
59+
else
60+
System.out.println("add is not possible");
61+
}
62+
}

Diff for: addtwo.class

879 Bytes
Binary file not shown.

Diff for: addtwo.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.*;
2+
class addtwo
3+
{
4+
public static void main(String args[])
5+
{
6+
int a,b,sum;
7+
Scanner obj = new Scanner(System.in);
8+
System.out.println("Enter the first number");
9+
a = obj.nextInt();
10+
11+
System.out.println("Enter the second number");
12+
b = obj.nextInt();
13+
sum=a+b;
14+
System.out.println("sum of two numbers :"+sum);
15+
}
16+
}

Diff for: amstrong.class

1.13 KB
Binary file not shown.

Diff for: amstrong.java

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import java.util.*;
2+
class amstrong
3+
{
4+
public static void main(String args[])
5+
{
6+
int a,temp,count=0,result=0,d,i;
7+
Scanner obj = new Scanner(System.in);
8+
System.out.println("enter the number");
9+
a = obj.nextInt();
10+
temp=a;
11+
while(a!=0)
12+
{
13+
a=a/10;
14+
count++;
15+
}
16+
a=temp;
17+
while(a!=0)
18+
{ int multi=1;
19+
d=a%10;
20+
for(i=0;i<count;i++)
21+
multi =multi*d ;
22+
a=a/10;
23+
result = result+multi;
24+
}
25+
a=temp;
26+
if(result==temp)
27+
System.out.println("the number "+a+" is amstrong");
28+
else
29+
System.out.println("the number "+a+" is not amstrong");
30+
}
31+
}
32+

Diff for: area.class

1.5 KB
Binary file not shown.

Diff for: area.java

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import java.util.*;
2+
class area
3+
{
4+
public static void main(String args[])
5+
{
6+
Scanner ob = new Scanner(System.in);
7+
area obj= new area();
8+
System.out.println("enter the length of rectangle");
9+
int l = ob.nextInt();
10+
System.out.println("enter the breath of rectangle");
11+
int b = ob.nextInt();
12+
System.out.println("enter the radius of circle");
13+
float r = ob.nextFloat();
14+
System.out.println("enter the height of triangle");
15+
float h = ob.nextFloat();
16+
System.out.println("enter the base of triangle");
17+
float ba = ob.nextFloat();
18+
obj.areaofshape(l,b);
19+
obj.areaofshape(h,ba);
20+
obj.areaofshape(r);
21+
}
22+
23+
void areaofshape(int l,int b)
24+
{
25+
int area = l*b;
26+
27+
System.out.println("area of rectangle = "+area);
28+
}
29+
void areaofshape(float h,float ba)
30+
{
31+
float area = (h*ba)/2;
32+
33+
System.out.println("area of triangle = "+area);
34+
}
35+
void areaofshape(float r)
36+
{
37+
double area = 3.14*r*r;
38+
39+
System.out.println("area of circle = "+area);
40+
}
41+
}

Diff for: concatenate.class

1.24 KB
Binary file not shown.

Diff for: concatenate.java

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.util.*;
2+
class concatenate
3+
{
4+
public static void main(String args[])
5+
{
6+
Scanner ob = new Scanner(System.in);
7+
concatenate obj= new concatenate();
8+
System.out.println("enter the first number");
9+
int first = ob.nextInt();
10+
System.out.println("enter the second number");
11+
int second = ob.nextInt();
12+
13+
System.out.println("enter the first string");
14+
String s= ob.next();
15+
16+
System.out.println("enter the second string");
17+
String r= ob.next();
18+
19+
obj.concat(first,second);
20+
obj.concat(s,r);
21+
}
22+
23+
void concat(int f,int s)
24+
{
25+
System.out.println("concatenated numbers is = "+f+s);
26+
}
27+
void concat(String f,String s)
28+
{
29+
System.out.println("concatenated string is = "+f+s);
30+
}
31+
}

Diff for: employ.class

1.33 KB
Binary file not shown.

Diff for: employ.java

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import java.util.*;
2+
class employ
3+
{
4+
int e,p;
5+
String s;
6+
7+
public static void main(String args[])
8+
{
9+
int i;
10+
11+
Scanner obb = new Scanner(System.in);
12+
employ obj[] = new employ[20];
13+
System.out.println("how many number of employs");
14+
int n = obb.nextInt();
15+
for(i=0;i<n;i++)
16+
{
17+
obj[i]= new employ();
18+
System.out.println("enter the empno");
19+
obj[i].e =obb.nextInt();
20+
System.out.println("enter name of employs");
21+
obj[i].s=obb.next();
22+
System.out.println("enter the phone number");
23+
obj[i].p=obb.nextInt();
24+
}
25+
for(i=0;i<n;i++)
26+
{
27+
28+
29+
System.out.println("the empno:"+obj[i].e);
30+
System.out.println("the name of employ:"+obj[i].s);
31+
System.out.println("the phonenumebr :"+obj[i].p);
32+
}
33+
34+
}
35+
}
36+

Diff for: factor.class

667 Bytes
Binary file not shown.

Diff for: factor.java

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

Diff for: factorial.class

711 Bytes
Binary file not shown.

Diff for: factorial.java

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

Diff for: fibonacci.class

731 Bytes
Binary file not shown.

Diff for: fibonacci.java

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

Diff for: freqandrev.class

1.55 KB
Binary file not shown.

Diff for: freqandrev.java

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import java.util.*;
2+
class freqandrev
3+
{
4+
public static void main(String args[])
5+
{
6+
freqandrev obj= new freqandrev();
7+
System.out.println("enter the string");
8+
Scanner ob = new Scanner(System.in);
9+
String s = ob.nextLine();
10+
int z = s.length();
11+
char x[]=s.toCharArray();
12+
System.out.println("enter the character to find the frequency of time it repeat");
13+
char y = ob.next().charAt(0);
14+
obj.frequency(x,y,z);
15+
obj.rev(x,z);
16+
17+
}
18+
19+
void frequency(char x[],char y,int z)
20+
{
21+
int count=0,i;
22+
for(i=0;i<z;i++)
23+
if(y==x[i])
24+
count++;
25+
if(count==0)
26+
System.out.println("entered the character is not in the string");
27+
else
28+
System.out.println("enter the character repeat "+count+"times");
29+
}
30+
void rev(char x[],int z)
31+
{
32+
int i,j;
33+
char r[]= new char[20];
34+
for(i=0,j=z-1;i<z;i++,j--)
35+
r[j]=x[i];
36+
System.out.println("the string in rev form is");
37+
for(i=0;i<z;i++)
38+
System.out.print(r[i]);
39+
}
40+
}
41+
42+
43+

Diff for: frequency.class

1.29 KB
Binary file not shown.

Diff for: frequency.java

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.util.*;
2+
class frequency
3+
{
4+
public static void main(String args[])
5+
{
6+
System.out.println("enter the string");
7+
Scanner obj = new Scanner(System.in);
8+
String n = obj.nextLine();
9+
int y = n.length();
10+
y--;
11+
int count = 0;
12+
char x[] = n.toCharArray();
13+
int i,flag=0;
14+
System.out.println("enter the character to count the frequecy count");
15+
char s = obj.next().charAt(0);
16+
for(i=0;i<=y;i++)
17+
if(x[i] == s)
18+
{
19+
flag=1;
20+
count = count+1;
21+
}
22+
if(flag==1)
23+
System.out.println("the frequency of time the character repeat is "+count);
24+
else
25+
System.out.println("entered the character to count the frequecy count is not in the string");
26+
}
27+
}

Diff for: larnxn.class

1.28 KB
Binary file not shown.

Diff for: larnxn.java

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import java.util.*;
2+
class larnxn
3+
{
4+
public static void main(String args[])
5+
{
6+
7+
Scanner obj = new Scanner(System.in);
8+
System.out.println("how many row");
9+
int r = obj.nextInt();
10+
System.out.println("how many coln");
11+
int c = obj.nextInt();
12+
int a[][] = new int[10][10];
13+
System.out.println("enter the elements into the array");
14+
for(int i=0;i<r;i++)
15+
for(int j=0;j<c;j++)
16+
a[i][j] = obj.nextInt();
17+
18+
for(int i=0;i<r;i++)
19+
{
20+
System.out.println();
21+
for(int j=0;j<c;j++)
22+
System.out.print(a[i][j]+" ");
23+
}
24+
int l=0;
25+
for(int i=0;i<r;i++)
26+
for(int j=0;j<c;j++)
27+
if(a[i][i]>l)
28+
l= a[i][j];
29+
30+
System.out.println("the largest element is "+l);
31+
}
32+
}

Diff for: multmat.class

1.88 KB
Binary file not shown.

0 commit comments

Comments
 (0)