-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbbbfe6
commit 0df3f84
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import java.util.*; | ||
class a1q1 | ||
{ | ||
public static void main(String args[]) | ||
{ | ||
Scanner in = new Scanner(System.in); | ||
System.out.print("Enter the Value of a: "); | ||
int a=in.nextInt(); | ||
System.out.print("Enter the value of b: "); | ||
int b=in.nextInt(); | ||
System.out.print("Enter the value of c: "); | ||
int c=in.nextInt(); | ||
boolean k=false; | ||
if(a+b==c || a==b-c || a*b==c) | ||
k=true; | ||
if(k) | ||
{ | ||
System.out.print(a+", "+b+", "+c+" can be used in an arithmatic formula"); | ||
} | ||
else | ||
{ | ||
System.out.print(a+", "+b+", "+c+" cannot be used in an arithmatic formula"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import java.util.*; | ||
class a1q2 | ||
{ | ||
public static void main(String args[]) | ||
{ | ||
Scanner in = new Scanner(System.in); | ||
System.out.print("Enter the Number : "); | ||
int n=in.nextInt(); | ||
double t1=Math.log(n), t2=Math.log(2); | ||
int ans=(int)(t1/t2); | ||
System.out.print(n+" must be divided by two "+ans+" times to get a value less than 2"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import java.util.*; | ||
class a1q3 | ||
{ | ||
public static void main(String args[]) | ||
{ | ||
Scanner in = new Scanner(System.in); | ||
char ch[] = {'a','r','b','o','n'}; | ||
a1q3 ob = new a1q3(); | ||
int i=1; | ||
for(int a=0; a<5; a++) | ||
{ | ||
for(int b=0; b<5; b++) | ||
{ | ||
for(int c=0; c<5; c++) | ||
{ | ||
for(int d=0; d<5; d++) | ||
{ | ||
for(int e=0; e<5; e++) | ||
{ | ||
String s=""+ch[a]+ch[b]+ch[c]+ch[d]+ch[e]; | ||
if(ob.check(s)) | ||
{ | ||
System.out.println(i+") "+s); | ||
i++; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
public boolean check(String s) | ||
{ | ||
boolean k=true; | ||
for(int a=0; a<s.length()-1; a++) | ||
{ | ||
for(int b=a+1; b<s.length(); b++) | ||
{ | ||
if(s.charAt(a)==s.charAt(b)) | ||
{ | ||
k=false; | ||
break; | ||
} | ||
} | ||
} | ||
return k; | ||
} | ||
} |