import java.io.*; class ISCscores { int n[][]=new int [6][2]; ISCscores()throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter your marks"); for(int a=0;a<6;a++) { int b=0; String s=br.readLine(); n[a][b]=Integer.parseInt(s); n[a][1]=point(n[a][b]); } } public int point(int x) { if(x>=90) return 1; else if(x>=80 &&x<=89) return 2; else if(x>=70 &&x<=79) return 3; else if(x>=60 &&x<=69) return 4; else if(x>=50 &&x<=59) return 5; else if(x>=40 &&x<=49) return 6;
else return 7; } } import java.io.*; class best4 extends ISCscores { public best4()throws IOException { super(); int tmp,t; for(int i=0;i<6;i++) { for(int j=0;j<5-i;j++) { if(n[j][0]>n[i][0]) { tmp=n[j][0]; n[j][0]=n[i][0]; n[i][0]=tmp; t=n[j][1]; n[j][1]=n[i][1]; n[i][1]=t; } } } int sum=0; for(int k=5;k>1;k--) { sum=sum+n[k][1]; System.out.println(n[k][0]);
} System.out.println("Sum of pts="+sum); } } import java.io.*; class marks extends student { int regnum,marks; String subject; marks(int num,int mark,String sub,String nam,String se,int ag) { super(nam,se,ag); regnum=num; marks=mark; subject=sub; } void inpdetails(int num,int mark,String sub) { regnum=num; marks=mark; subject=sub; } void Showdetails() { showone(); System.out.println("marks obtained in "+subject+" are "+marks); } } import java.io.*; class student {
InputStreamReader i=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(i); char name[],sex[]; int age; student(String s,String s1,int ag) { age=ag; name=s.toCharArray(); sex=s1.toCharArray(); } public void impDetails1()throws IOException { System.out.println("Enter name"); String s=br.readLine(); name=s.toCharArray(); System.out.println("Enter sex of child"); String s1=br.readLine(); sex=s1.toCharArray(); System.out.println("Enter age of child"); String s2=br.readLine(); age =Integer.parseInt(s2); } void showone() { System.out.print("name of cild is "); for(int y=0;y
for(int y=0;y<sex.length;y++) { System.out.print(sex[y]); }
System.out.println("age of child is "+age); } } class tip { public static void main(String x) { int a,c=0;x+=')'; char ch,s[]=new char[x.length()]; s[0]='('; for(a=0;a<x.length();a++) { ch=x.charAt(a); if(ch=='(') s[++c]=ch; else if(ch<91 && ch>64) System.out.print(ch); else if(ch==')') { for(;s[c]!='(';) System.out.println(s[c--]); c--; } else { if(s[c]=='(')
s[++c]=ch; else { while(pref(s[c],ch)&&s[c]!='(') { System.out.print(s[c--]); s[c++]=ch; } } } } } public static boolean pref(char a,char b) { int y=0,z=0; if(a=='^')
y=1; else if(a=='/'||a=='*'||a=='%') y=2; else y=3; if(b=='^') z=1; else if(b=='/'||b=='*'||b=='%') z=2; else z=3; if(y<=z) return true; else return false; }
} class rearrange { int q; char str[]=new char[200]; char substr1[]=new char[200]; public rearrange() { for(int b=0;b<200;b++) { str[b]=' '; substr1[b]=' '; } q=0; } public rearrange(char s[],int y) { q=y; for(int g=0;g
{ for(int w=0;w
public static void main(int a) { reverse(a); } public static void reverse(int x) { if(x==0) return; else { reverse(x/2); System.out.println(x%2); } } } import java.io.*; class angle { int deg,min; public angle() { deg=0;min=0; } public void accept()throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter angle in degree and minutes"); deg=Integer.parseInt(br.readLine()); min=Integer.parseInt(br.readLine()); } public angle sumangle(angle ob1,angle ob2)
{ angle ob=new angle(); ob.deg=ob1.deg+ob2.deg; ob.min=ob1.min+ob2.min; while(ob.min>=60) { ob.min-=60; ob.deg++; } return ob; } public void main()throws IOException { angle ob1=new angle(); angle ob2=new angle(); angle ob3=new angle(); ob1.accept(); ob2.accept(); ob3=sumangle(ob1,ob2); System.out.println(ob3.deg+" "+ob3.min); } } WAP to print the following pattern of odd lengthed string. W E L W
E
L
C O M E
import java.util.*;
O
M
E
class pattern { public void main()throws Exception { Scanner ob=new Scanner(System.in); System.out.println("enter any string"); String s=ob.nextLine(); int a,b,c=s.length()/2; for(a=0;a<s.length();a++) { if(a==s.length()/2) System.out.println(s); else { for(b=0;b
for(a=0;a<x.length();a++) { ch=x.charAt(a); if(ch=='(') s[++c]=ch; else if(ch<91 && ch>64) System.out.print(ch); else if(ch==')') { for(;s[c]!='(';) System.out.print(s[c--]); c--; } else { if(s[c]=='(') s[++c]=ch; else { while(pref(s[c],ch) && s[c]!='(') { System.out.print(s[--c]); s[++c]=ch; } } } } } public static boolean pref(char a,char b) { int y=0,z=0;
if(a=='^') y=1; else if(a=='/'||a=='*'||a=='%') y=2; else y=3; if(b=='^') z=1; else if(b=='/'||b=='*'||b=='%') z=2; else z=3; if(y<=z) return true; else return false; } } class noOfDays { public static void main(int yy,int n) { int d[]={31,28,31,30,31,30,31,31,30,31,30,31}; int mm=0,dd=0; int y=365,s=0,m; if(y%100==0 && y%400==0) d[1]=29; else if(y%4==0) d[1]=29; y=366;n=n%y; for(m=0;m<12;m++) {
if(s+d[m]>n) { dd=n-s; mm=mm+1;} else s=s+d[m];} System.out.println(dd+"/"+(12-mm+1)+" "+" "+yy); } }