//File name: Big.html
<HTML>
<HEAD>
<TITLE>Biggest Number</TITLE>
</HEAD>
<BODY>
<H1>Program to find biggest of 2, 3 or N numbers using method overloading</H1>
<FORM name="frm" ACTION="Big.jsp" METHOD="POST" >
<h3> Enter 2, 3 or N numbers (Press Enter key after one input):<h3>
<TEXTAREA NAME="textarea1" autofocus onfocus="textarea1.value=''" ROWS="1">
</TEXTAREA>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit" >
</FORM>
</BODY>
<HTML>
//Filename: Big.jsp
//01.Program to find biggest number from 2,3 or N numbers using method overloading.
<HTML>
<HEAD>
<TITLE>Program to find biggest number among given numbers</TITLE>
<%@ page import="java.io.*,java.util.*,java.lang.*" %>
</HEAD>
<BODY>
<%
String str=request.getParameter("textarea1");
char ch[]=str.toCharArray();
int len= str.length();
int dig=0,op1,op2,op3,op4;
%>
<%!
int big;
int a[]=new int[100];
int j=0,i;
%>
<%
for(i=0;i<len;i++)
{
if(ch[i]=='\r')
{
switch(i)
{
case 1:
a[j++]=Character.getNumericValue(ch[i-1]);
len=0;
break;
case 2:
op1=Character.getNumericValue(ch[i-2]);
op2=Character.getNumericValue(ch[i-1]);
dig=op1*10+op2;
a[j++]=dig;
len=0;
break;
case 3:
op1=Character.getNumericValue(ch[i-3]);
op2=Character.getNumericValue(ch[i-2]);
op3=Character.getNumericValue(ch[i-1]);
dig=op1*100+op2*10+op3;
a[j++]=dig;
len=0;
break;
case 4:
op1=Character.getNumericValue(ch[i-4]);
op2=Character.getNumericValue(ch[i-3]);
op3=Character.getNumericValue(ch[i-2]);
op4=Character.getNumericValue(ch[i-1]);
dig=op1*1000+op2*100+op3*10+op4;
a[j++]=dig;
len=0;
break;
default:
out.println("Default");
}
}
}
%>
<h3 color=blue> The given numbers are:</h3>
<br>
<%
for(i=0;i<j;i++)
{
out.println("a["+i+"]="+a[i]);
%>
<BR>
<%
}
%>
<BR>
<%
out.println("Biggest Number is:");
if(j==2)
big=biggest(a[0],a[1]);
else if(j==3)
big =biggest(a[0],a[1],a[2]);
else
big=biggest(a,j);
out.println(big);
%>
<%!
int biggest(int a, int b) // for two nos.
{
if (a>b)
{
return(a);
}
return(b);
}
int biggest(int a , int b, int c) //for three nos.
{
int big1;
if (a>b && a>c)
{
big1 = a;
}
else
{
if (b>c)
{
big1 = b;
}
else
{
big1 = c;
}
}
return(big1);
}
int biggest(int num[], int n) //for n numbers
{
int big1;
big1=num[0];
for(int i=0;i<n;i++)
{
if(num[i]>big1)
big1=num[i];
}
return big1;
}
%>
</body>
</html>
<HTML>
<HEAD>
<TITLE>Biggest Number</TITLE>
</HEAD>
<BODY>
<H1>Program to find biggest of 2, 3 or N numbers using method overloading</H1>
<FORM name="frm" ACTION="Big.jsp" METHOD="POST" >
<h3> Enter 2, 3 or N numbers (Press Enter key after one input):<h3>
<TEXTAREA NAME="textarea1" autofocus onfocus="textarea1.value=''" ROWS="1">
</TEXTAREA>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit" >
</FORM>
</BODY>
<HTML>
//Filename: Big.jsp
//01.Program to find biggest number from 2,3 or N numbers using method overloading.
<HTML>
<HEAD>
<TITLE>Program to find biggest number among given numbers</TITLE>
<%@ page import="java.io.*,java.util.*,java.lang.*" %>
</HEAD>
<BODY>
<%
String str=request.getParameter("textarea1");
char ch[]=str.toCharArray();
int len= str.length();
int dig=0,op1,op2,op3,op4;
%>
<%!
int big;
int a[]=new int[100];
int j=0,i;
%>
<%
for(i=0;i<len;i++)
{
if(ch[i]=='\r')
{
switch(i)
{
case 1:
a[j++]=Character.getNumericValue(ch[i-1]);
len=0;
break;
case 2:
op1=Character.getNumericValue(ch[i-2]);
op2=Character.getNumericValue(ch[i-1]);
dig=op1*10+op2;
a[j++]=dig;
len=0;
break;
case 3:
op1=Character.getNumericValue(ch[i-3]);
op2=Character.getNumericValue(ch[i-2]);
op3=Character.getNumericValue(ch[i-1]);
dig=op1*100+op2*10+op3;
a[j++]=dig;
len=0;
break;
case 4:
op1=Character.getNumericValue(ch[i-4]);
op2=Character.getNumericValue(ch[i-3]);
op3=Character.getNumericValue(ch[i-2]);
op4=Character.getNumericValue(ch[i-1]);
dig=op1*1000+op2*100+op3*10+op4;
a[j++]=dig;
len=0;
break;
default:
out.println("Default");
}
}
}
%>
<h3 color=blue> The given numbers are:</h3>
<br>
<%
for(i=0;i<j;i++)
{
out.println("a["+i+"]="+a[i]);
%>
<BR>
<%
}
%>
<BR>
<%
out.println("Biggest Number is:");
if(j==2)
big=biggest(a[0],a[1]);
else if(j==3)
big =biggest(a[0],a[1],a[2]);
else
big=biggest(a,j);
out.println(big);
%>
<%!
int biggest(int a, int b) // for two nos.
{
if (a>b)
{
return(a);
}
return(b);
}
int biggest(int a , int b, int c) //for three nos.
{
int big1;
if (a>b && a>c)
{
big1 = a;
}
else
{
if (b>c)
{
big1 = b;
}
else
{
big1 = c;
}
}
return(big1);
}
int biggest(int num[], int n) //for n numbers
{
int big1;
big1=num[0];
for(int i=0;i<n;i++)
{
if(num[i]>big1)
big1=num[i];
}
return big1;
}
%>
</body>
</html>
Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ReplyDeleteDevops Training courses
python Training in chennai
Devops Training in Bangalore
The site was so nice, I found out about a lot of great things. I like the way you make your blog posts. Keep up the good work and may you gain success in the long run.
ReplyDeletePython Online training
python Course institute in Chennai
Python Course institute in Bangalore
All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle,keep up!!
ReplyDeleteandroid training in chennai
android online training in chennai
android training in bangalore
android training in hyderabad
android Training in coimbatore
android training
android online training
ReplyDeleteNice blog! Thanks for sharing this valuable information
DevOps Training in Bangalore
Devops Training in Pune
Really nice blog. thanks for sharing
ReplyDeletepython training centre in chennai
best python institute in chennai
Extraordinary Blog. Provides necessary information.
ReplyDeletebest selenium training center in chennai
best selenium training center in chennai
kralbet
ReplyDeletebetpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
betmatik
GR4G
شركة تنظيف بالقصيم ZMiDQ5Vc0C
ReplyDelete