tag:blogger.com,1999:blog-25544631150496232482024-03-13T14:21:59.861-07:00Programming TutorialsA Blog on Computer Programming Tutorials and many other tips and tricks of computer.A resource for Learning Computer Programming related to C++, JAVA, PHP and other programming language.Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-2554463115049623248.post-35078204653243635412011-07-19T22:46:00.000-07:002011-07-19T22:48:48.110-07:00Redirect a Page with time delay using JavaScriptMany times we need to redirect from one page to another webpage with some delay. Doing this using JavaScript is very easy.<br />
Just Create a simple HTML page using this code and change the form action and view in browser.<br />
<br />
<br />
<br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><html></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><head></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><script type="text/javascript"></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">function delay()</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">{</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> window.location = "http://anurag-tutorial.blogspot.com" </span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">}</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></script></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></head></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><body onLoad="setTimeout('delay()', 5000)"></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><h2>Redirecting to Programming Tutorial !</h2></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><p>You are about to go to Programming Tutorial page after time delay!</p></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></body></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></html></span><br />
<br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">When you test it in your browser yow will see that you will be redirected to </span>Programming Tutorial page in after a delay time<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">.</span><br />
<br />
<pre class="code"></pre>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com1tag:blogger.com,1999:blog-2554463115049623248.post-87896685571097921322011-06-27T02:58:00.000-07:002011-06-27T03:01:19.818-07:00Post a form using JavaScript<div dir="ltr" style="text-align: left;" trbidi="on"><br />
We normally post a form with Submit button but we can also post a form using JavaScript.<br />
We can use image or simple hyperlink to post a form using this method.<br />
<br />
Just Create a simple HTML page using this code and change the form action and view in browser.<br />
<br />
<br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><html></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><head></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><title></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">Programing Tutorial by Anurag</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></title></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><script language="javascript"></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">function formsubmit()</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">{</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">document.formName.submit();</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">}</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></script></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></head></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><form name="formName" method="get" action="page2.htm"></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;">Name:<input type="text" name="name"></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><a href="#" onclick="formsubmit();">Click Here to submit</a></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></form></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><body></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></body></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"></html></span><br />
<br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">When you test it in your browser yow will see that your form will be posted and posted data will be seen in url of the page2.htm.</span><br />
<br />
</div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-14651533828216112582011-06-25T00:26:00.000-07:002011-06-25T00:31:15.686-07:00Change the Style with jQuery<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">This is a basic tutorial, written to help you get started using jQuery.<br />
This tutorial shows you how you can do some special effect using jquery.<br />
Download a copy of jquery from <a href="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" style="color: #ff1900; text-decoration: underline;" target="_blank">here</a>.</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">Just start by creating a new HTML page with the following contents:</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"><br />
</span><br />
<br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><html></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><head></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><script type="text/javascript"></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;">$(document).ready(function(){</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"> $("button").click(function(){</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"> $("#test").width("500px");</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><span class="Apple-tab-span" style="white-space: pre;"> </span> });</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;">});</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"></script></span></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"><title>jQuery Programming Tutorial by Anurag</title></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"></head></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><body><button>Click me</button></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><div id="test" style="background-color:#B6FFA4;height:20px;width:240px">Welcome To Programming Tutorials</div></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"></body></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"></html></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3; font-size: 15px; line-height: 21px;"><br />
</span></span><br />
<span class="Apple-style-span" style=" color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">You can test it, just click on Click me button in this HTML page and the width of the div will be changed. Yo can do more same way.</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="font-size: 15px; line-height: 21px;"><br />
</span></span></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-40329728537129938282011-06-24T04:23:00.001-07:002011-06-25T00:28:40.838-07:00Animate a link using Jquery<div dir="ltr" style="text-align: left;" trbidi="on">This is a basic tutorial, written to help you get started using jQuery.<br />
This tutorial shows you how you can do some special effect using jquery.<br />
Download a copy of jquery from <a href="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" target="_blank">here</a>.<br />
<br />
Just start by creating a new HTML page with the following contents:<br />
<br />
<br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><html></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> <head></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> <title> Jquery Programming Tutorial by Anurag</title></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> </head></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> <body></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> <a href="http://anurag-tutorial.blogspot.com/"> Programming Tutorial by Anurag</a></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> <script></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> $(document).ready(function(){</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> $("a").click(function(event){</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> event.preventDefault();</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $(this).hide("slow");</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> });</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> });</span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> </script></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> </body></span><br />
<span class="Apple-style-span" style="background-color: #d9ead3;"> </html></span><br />
<div><br />
</div><div>You can test it, just click on hyper link in this HTML page and it will disappear with animation.</div><br />
</div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-78347615139356157972011-06-23T23:00:00.000-07:002011-06-23T23:05:12.941-07:00Java Program take no from user and print the sum of even and odd nos.<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">Open notepad or any text editor and type this code.</span><br />
<br />
<div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">import java.io.*;</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">class sumeo</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> public static void main(String args[]) throws IOException</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> String a;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("Enter a No: ");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> a=ob.readLine();</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int b=Integer.parseInt(a);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int even=0,odd=0;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> for(int i=1;i<=b;i++)</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int c=i%2;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> if(c==0)</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> even=even+i;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> } </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> else</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> odd=odd+i;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("Sum of even nos. is: "+even);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("Sum of odd nos. is: "+odd);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> } </span></div><span style="background-color: #d9ead3; font-family: 'Times New Roman'; font-size: 12pt;">}</span><br />
<br />
<br />
<span style="background-color: #d9ead3; font-family: 'Times New Roman';"></span><br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: left;">and save this file as sumeo.java in the bin directory (c:\j2sdk1.4.2\bin).</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Now open command prompt and go to your Java directory.</div><div class="separator" style="clear: both; text-align: left;">Now compile your program by typing javac sumeo.java</div><div class="separator" style="clear: both; text-align: left;">Now the program will be compiled.</div><div class="separator" style="clear: both; text-align: left;">Now Run your program by typing java sumeo</div><div class="separator" style="clear: both; text-align: left;">The output of the above program will be like this.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-oCzV4__eMPo/TgQoC5hfcZI/AAAAAAAAACE/aN1qRkDE1C0/s1600/sum.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="215" src="http://2.bp.blogspot.com/-oCzV4__eMPo/TgQoC5hfcZI/AAAAAAAAACE/aN1qRkDE1C0/s320/sum.JPG" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><br />
<br />
<span style="background-color: #d9ead3; font-family: 'Times New Roman'; font-size: 12pt;"><br />
</span></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-17225154338548711022011-06-23T22:57:00.000-07:002011-06-23T23:06:14.395-07:00Java Program to Print the Fibonacci series up to desired no<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">Open notepad or any text editor and type this code.</span><br />
<div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">import java.io.*;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> class fibonacci</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> public static void main(String args[]) throws IOException</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("Enter the length of series: ");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> String d=ob.readLine();</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int j=Integer.parseInt(d);</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int a,b,c;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> a=0;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> b=1;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> c=0; </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println(a);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println(b);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> for(int i=0;i<(j-2);i++)</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> c=a+b;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println(c);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> a=b;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> b=c;</span></div><div class="MsoNormal"><span style="background-color: #d9ead3;"> </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><span style="background-color: #d9ead3; font-family: 'Times New Roman'; font-size: 12pt;"> }</span><br />
<br />
<br />
and save this file as fibonacci.java in the bin directory (c:\j2sdk1.4.2\bin).<br />
<br />
Now open command prompt and go to your Java directory.<br />
Now compile your program by typing javac fibonacci.java<br />
Now the program will be compiled.<br />
Now Run your program by typing java fibonacci<br />
<br />
The output of the above program will be like this.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-rolsaeRfIU0/TgQnRTLqnKI/AAAAAAAAACA/-3S6WZqeKxA/s1600/fabi.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="251" src="http://2.bp.blogspot.com/-rolsaeRfIU0/TgQnRTLqnKI/AAAAAAAAACA/-3S6WZqeKxA/s320/fabi.JPG" width="320" /></a></div><br />
<br />
<span style="background-color: #d9ead3; font-family: 'Times New Roman'; font-size: 12pt;"></span><br />
<div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="font-size: 15px; line-height: 21px;"><br />
</span></span></div></div></div></div></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-2731827052002649662011-06-23T22:46:00.000-07:002011-06-23T22:46:26.117-07:00Java Program to takes value from user and finds its factorial<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Open notepad or any text editor and type this code.</span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="line-height: 21px;"></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;">import java.io.*;</span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></span></div></div></div><div class="MsoNormal"><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">class fact</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>{</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>public static void main(String args[]) throws IOException</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>{</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>System.out.println("Enter the no.: ");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>String a;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>int c=1;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>a=ob.readLine();</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>int i=Integer.parseInt(a);</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>while(i>0)</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>{</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>c=c*i;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>i--;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>} </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-tab-count: 1;"> </span>System.out.print("The factorial of "+a+" is: "+c);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>}</span></div><span style="font-family: "Times New Roman"; font-size: 12.0pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US;"><span class="Apple-style-span" style="background-color: #d9ead3;"><span style="mso-spacerun: yes;"> </span>}</span><span style="mso-spacerun: yes;"> </span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span"><br />
</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">and save this file as fact.java in the bin directory (c:\j2sdk1.4.2\bin).</span></span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span"><br />
</span></span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">Now open command prompt and go to your Java directory.</span></span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now compile your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">javac fact.java</span></span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now the program will be compiled.</span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now Run your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">java <span class="Apple-style-span">fact</span></span></span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></span></span></div></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">The output of the above program will be like this.</span></span></span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-KTO4ChtIyKc/TgQkpVChhXI/AAAAAAAAAB8/kDXC5DEuiDU/s1600/fact.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="249" src="http://3.bp.blogspot.com/-KTO4ChtIyKc/TgQkpVChhXI/AAAAAAAAAB8/kDXC5DEuiDU/s320/fact.JPG" width="320" /></a></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span"><br />
</span></span></span></div></div></div></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-34369904579334613312011-06-23T22:42:00.000-07:002011-06-23T22:48:44.681-07:00Java Program to make a Simple Calculator<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Open notepad or any text editor and type this code.</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="line-height: 21px;"></span></span></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;">import java.io.*;</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></span></div></div><div class="MsoNormal"><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">class cal</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> public static void main(String args[]) throws IOException</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> { String a,b,c;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int s;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("Enter the 1st no. :- ");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> a=ob.readLine(); </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("Enter the 2nd no. :- "); </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> b=ob.readLine();</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("Enter the Choice"+"\n"+"1 for Addition"+"\n"+"2 for </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> Subtraction"+"\n"+"3 for Multiplication"+"\n"+"4 for Division");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> c=ob.readLine();</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> s=Integer.parseInt(c);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> int r;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> switch (s)</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> { </span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> case 1:</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> r=Integer.parseInt(a)+Integer.parseInt(b);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("result is: "+r);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> break;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> case 2:</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> r=Integer.parseInt(a)-Integer.parseInt(b);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("result is: "+r);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> break;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> case 3:</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> r=Integer.parseInt(a)*Integer.parseInt(b);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("result is: "+r);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> break;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> case 4:</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> r=Integer.parseInt(a)/Integer.parseInt(b);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("result is: "+r);</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> break;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> default:</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("Wrong Choice");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> break;</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span><span class="Apple-style-span" style="color: #222222; font-size: 16px;"> </span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">and save this file as cal.java in the bin directory (c:\j2sdk1.4.2\bin).</span></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span"><br />
</span></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">Now open command prompt and go to your Java directory.</span></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now compile your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">javac cal.java</span></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now the program will be compiled.</span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now Run your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">java <span class="Apple-style-span">cal</span></span></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></span></span></div></div><div class="MsoNormal"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">The output of the above program will be like this.</span></span></span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-K8U4ECRej5k/TgQj0SgcQtI/AAAAAAAAAB4/HKRv568Qxns/s1600/cal.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="242" src="http://1.bp.blogspot.com/-K8U4ECRej5k/TgQj0SgcQtI/AAAAAAAAAB4/HKRv568Qxns/s320/cal.JPG" width="320" /></a></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span"><br />
</span></span></span></div></div></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-62728492400630165782011-06-23T22:38:00.000-07:002011-06-23T22:39:50.995-07:00Java Program to take two values from user and display sum of these values<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Open notepad or any text editor and type this code.</span></span><br />
<br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="line-height: 21px;"></span></span><br />
<div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;">import java.io.*;</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;">class userio</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> public static void main(String args[]) throws IOException</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> BufferedReader ob=new BufferedReader(new InputStreamReader(System.in));</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> String a,b;</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("Enter 1st no: ");</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> a=ob.readLine();</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.print("Enter 2nd no: ");</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> b=ob.readLine();</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> int c=Integer.parseInt(a)+Integer.parseInt(b);</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("The Sum is: "+c);</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="background-color: #d9ead3;"> } </span></span></div><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span style="font-family: 'Times New Roman'; font-size: 12pt;"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span> </span></span><br />
<div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><br />
</span></span><br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">and save this file as userio.java in the bin directory (c:\j2sdk1.4.2\bin).</span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span"><br />
</span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">Now open command prompt and go to your Java directory.</span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now compile your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">javac userio.java</span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now the program will be compiled.</span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;">Now Run your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">java <span class="Apple-style-span">userio</span></span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span">The output of the above program will be like this.</span></span></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-4F4NajBp6Uo/TgQi1V7LHWI/AAAAAAAAAB0/lk-HIpm2dRc/s1600/userio.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="216" src="http://2.bp.blogspot.com/-4F4NajBp6Uo/TgQi1V7LHWI/AAAAAAAAAB0/lk-HIpm2dRc/s320/userio.JPG" width="320" /></a></div><span class="Apple-style-span" style="color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif;"><span class="Apple-style-span" style="font-size: 15px; line-height: 21px;"><br />
</span></span></div></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-24819731730340486552011-06-23T00:56:00.000-07:002011-06-23T00:56:22.407-07:00Make a Simple Image Slide Show in JavaScript<div dir="ltr" style="text-align: left;" trbidi="on">We can make a simple Image Slider in JavaScript.<br />
Just Create a simple HTML page using this code and view the result.<br />
<br />
<span style="background-color: #d9ead3;"><html></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><head></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><title>Simple Slide</title></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"></head></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><script language="javascript"></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">// make a array of images and pass the location of every image.</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">var myPix = new Array("images/1.jpg", "images/2.jpg", "images/3.jpg");</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">var thisPic = 0;</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">function goPrevious() {</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> if (document.images && thisPic > 0) {</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> thisPic--;</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> document.myPicture.src = myPix[thisPic];</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> }</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">}</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">function goNext() {</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> if (document.images && thisPic < 2) {</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> thisPic++;</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> document.myPicture.src = myPix[thisPic];</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"> }</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;">}</span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"></script></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><body></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><img src="images/0.jpg" name="myPicture"><br> </span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><a href="javascript:goPrevious()">Previous</a></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><a href="javascript:goNext()">Next</a></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"><body></span><br style="background-color: #d9ead3;" /><span style="background-color: #d9ead3;"></html></span> <br />
<br />
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia,Utopia,'Palatino Linotype',Palatino,serif; font-size: 15px; line-height: 21px; text-align: left;">When you test it in your browser yow will see something like this:</span></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-Yiqi6-f1WZc/TgLxlnbfa2I/AAAAAAAAABs/IgmqvMB9f3Q/s1600/slide.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-Yiqi6-f1WZc/TgLxlnbfa2I/AAAAAAAAABs/IgmqvMB9f3Q/s320/slide.JPG" width="250" /></a></div><br />
<br />
<br />
<br />
<br />
</div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-83944255355104099342011-06-23T00:35:00.000-07:002011-06-23T00:35:39.213-07:00Find the sum of the digits<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on">A simple program to show How to find the sum of the digits from 1 to desired digit using JavaScript.<br />
Create a simple HTML page using this code and view the result.<br />
<br />
<span style="background-color: #d9ead3;"><html></span><br />
<span style="background-color: #d9ead3;"><head></span><br />
<span style="background-color: #d9ead3;"><title>Sum of Nos</title></span><br />
<span style="background-color: #d9ead3;"></head></span><br />
<span style="background-color: #d9ead3;"><script language="javascript"></span><br />
<span style="background-color: #d9ead3;">function findsum(num) {</span><br />
<span style="background-color: #d9ead3;"> var i, sum = 0; </span><br />
<span style="background-color: #d9ead3;"> for (i = 1; i <= num; i++) {</span><br />
<span style="background-color: #d9ead3;"> sum += i; </span><br />
<span style="background-color: #d9ead3;"> }</span><br />
<span style="background-color: #d9ead3;"> alert("The sum of the digits from 1 to "+ num + " is:\n\n\t " + sum);</span><br />
<br />
<span style="background-color: #d9ead3;">}</span><br />
<span style="background-color: #d9ead3;"></script></span><br />
<span style="background-color: #d9ead3;"><body></span><br />
<span style="background-color: #d9ead3;">JavaScript Program - Find the sum of the digits.</span><br />
<span style="background-color: #d9ead3;"><form name="adddigits"></span><br />
<span style="background-color: #d9ead3;"> The sum of the digits from 1 to:</span><br />
<span style="background-color: #d9ead3;"> <input type="text" name="num"></span><br />
<span style="background-color: #d9ead3;"> <input type="button" value="Calculate" onClick="findsum(adddigits.num.value)"></span><br />
<span style="background-color: #d9ead3;"></form></span><br />
<span style="background-color: #d9ead3;"></body></span><br />
<span style="background-color: #d9ead3;"></html></span><br />
<br />
When you test it in your browser yow will see something like this:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-GO6WEuLk_pw/TgLspy-xwkI/AAAAAAAAABo/esjjDkGWXUI/s1600/sum.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="273" src="http://2.bp.blogspot.com/-GO6WEuLk_pw/TgLspy-xwkI/AAAAAAAAABo/esjjDkGWXUI/s320/sum.JPG" width="320" /></a></div><br />
</div></div></div></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-42844462746214078662011-06-22T02:59:00.000-07:002011-06-22T03:04:02.990-07:00Reduce PDF file size in Adobe Professional<div dir="ltr" style="text-align: left;" trbidi="on"><div>Some times we notice that the size of a pdf file becomes very large due to graphics and images. If You want to reduce its size just Follow these steps.<br />
<ul style="text-align: left;"><li>Open your PDF in Adobe Professional</li>
<li> Click File -> reduce File Size</li>
<li>Save the file.</li>
</ul></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-ZNz9ia0BVHo/TgGaTxG0MdI/AAAAAAAAAAM/6sdQjMEp80s/s1600/Hello.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://lh3.googleusercontent.com/-rz-hDXku0N4/TgG9e0eafeI/AAAAAAAAABk/Ly7km-JVUnM/reduce.gif" /></a></div><div>It reduces the file size, but we want more reduced size, so do a trick<br />
<ul style="text-align: left;"><li> Open again previously saved PDF file in Adobe Professional</li>
<li>Now save the file compatible for Advanced version say Ver. 7</li>
<li>Now again open the file and Save again in less Advanced version say Ver. 4 </li>
</ul></div>Now we have done. Check the file size. It's size has been reduced near about 40 % more.<br />
<br />
Enjoy .</div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-58085768092710150732011-06-22T02:02:00.000-07:002011-06-22T02:32:18.959-07:00Write a Program to use if - else in Java<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia,Utopia,'Palatino Linotype',Palatino,serif; font-size: 15px; line-height: 21px; text-align: left;">Open notepad or any text editor and type this code.</span></span><br />
<br />
<span class="Apple-style-span" style="color: #222222; font-family: Georgia,Utopia,'Palatino Linotype',Palatino,serif; font-size: 15px; line-height: 21px; text-align: left;"><span style="background-color: #d9ead3; font-size: small;">public static void main(String args[])<br />
{<br />
int a=5,b=8;<br />
System.out.print("2 nos. are: "+a+" and "+b+"\n");<br />
if(a>b)<br />
{<br />
System.out.print("Bigger no is:"+a);<br />
}<br />
else<br />
{<br />
System.out.print("Bigger no is:"+b);<br />
}<br />
}<br />
}</span></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia,Utopia,'Palatino Linotype',Palatino,serif; font-size: 15px; line-height: 21px; text-align: left;"><div class="MsoNormal"><br />
<span class="Apple-style-span">and save this file as example.java in the bin directory (c:\j2sdk1.4.2\bin).</span></div><div class="MsoNormal"><span class="Apple-style-span"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span">Now open command prompt and go to your Java directory.</span></div><div class="MsoNormal">Now compile your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">javac ifelse.java</span></div><div class="MsoNormal">Now the program will be compiled.</div><div class="MsoNormal">Now Run your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">java </span><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Georgia,Utopia,'Palatino Linotype',Palatino,serif; font-size: 15px; line-height: 21px; text-align: left;"><span class="Apple-style-span" style="background-color: #d9ead3;">ifelse</span></span></span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span">The output of the above program will be like this.</span><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-ZNz9ia0BVHo/TgGaTxG0MdI/AAAAAAAAAAM/6sdQjMEp80s/s1600/Hello.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://lh3.googleusercontent.com/-Wb0bQZDSkdA/TgGwN6lueDI/AAAAAAAAAAU/gtGAhjl5DXw/ifelse.JPG" /></a></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: white;"><br />
</span></div></span></span></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0tag:blogger.com,1999:blog-2554463115049623248.post-91290994906036105132011-06-22T00:32:00.000-07:002011-06-22T01:39:03.169-07:00Write a Simple Java Program<div dir="ltr" style="text-align: left;" trbidi="on">First of all download Java SDK from <a href="http://www.oracle.com/technetwork/indexes/downloads/index.html" target="_blank">here</a>. Then install it.<br />
Now open notepad or any text editor and type this code.<br />
<br />
<div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">class example</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;">{</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> public static void main(String args[])</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> {</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> System.out.println("ANURAG");</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"> }</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span">and save this file as example.java in the bin directory (c:\j2sdk1.4.2\bin).</span></div><div class="MsoNormal"><span class="Apple-style-span"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span">Now open command prompt and go to your Java directory.</span></div><div class="MsoNormal">Now compile your first program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">javac example.java</span></div><div class="MsoNormal">Now the program will be compiled.</div><div class="MsoNormal">Now Run your program by typing <span class="Apple-style-span" style="background-color: #d9ead3;">java example</span></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: #d9ead3;"><br />
</span></div><div class="MsoNormal"><span class="Apple-style-span">The output of the above program will come like this.</span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-ZNz9ia0BVHo/TgGaTxG0MdI/AAAAAAAAAAM/6sdQjMEp80s/s1600/Hello.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="http://1.bp.blogspot.com/-ZNz9ia0BVHo/TgGaTxG0MdI/AAAAAAAAAAM/6sdQjMEp80s/s320/Hello.JPG" width="320" /></a></div><div class="MsoNormal"><span class="Apple-style-span" style="background-color: white;"><br />
</span></div></div>Anuraghttp://www.blogger.com/profile/03307821681580389568noreply@blogger.com0