writing programs 1 Answer(s) 3 years and a month ago
Posted in : Java Beginners
1.write a program to display odd numbers from 1-50.
2.And Write a program to find the facorial of a number
View Answers
May 10, 2010 at 10:52 AM
Hi Friend,
1) class OddNumbers{ public static void main (String args[]){ String oddNo = ""; for (int i = 1; i <=50; i++){ if (i % 2 != 0) { oddNo += i + " "; } } System.out.println("Odd Numbers between 1 to 50 are: "+oddNo); } }
2) import java.util.*; class factorial{ public static void main(String []args){ Scanner input=new Scanner(System.in); System.out.print("Enter Number:"); int num=input.nextInt(); long fac=num; for(int i=num;i>1;i--) { fac=fac*(i-1); } System.out.println(fac); } }
Thanks
Related Pages:
writing programs - Java Beginners writing programs 1.write a program to display odd numbers from 1-50.
2.And Write a program to find the facorial of a number Hi Friend,
1)
class OddNumbers{
public static void main (String args
writing java programs - Java Beginners writing java programs How do i write a code to display even numbers from 1 to 50 Hi Friend,
Try the following code:
class EvenNumbers{
public static void main (String args[]){
String evenNo
Simple Java Programs
Simple Java Programs
In this section we will discuss about the Java programs
This section will describe you the various Java programs that will help you...
will describe you all the steps for writing a file in Java.
How to copy file in Java
Making Money by Writing Articles on the Internet
Making Money by Writing Articles on the Internet
 ... provided by the internet to common people. Article writing is one of them..., they can opt for joining affiliate programs with these companies hosting their websites
Programs in java Programs in java Hi,
What are the best programs in java for a beginner?
Thanks
java programs
java programs Why word "static" is used in java programs
Java: Programs
Java: Programs
Kinds of Programs
There are several types of programs that you can build in Java.
Applications - Main programs that run independently... Interface (GUI).
Applets - Programs downloaded over the Internet that run in Web pages
Java Programs
Java Programs Hi,
What is Java Programs?
How to develop application for business in Java technology? Is there any tool to help Java programmer in development of Java Programs?
Thanks
php programs
php programs I need 15 programs on arithmetic operators with comments. Please help me
java programs
java programs Explain types of Java programs. Also explain how to compile and run them.
Types of Java Programs:
Standalone Applications
Web Applications
Enterprise Applications
Console Application
Web services
programs in java programs in java . I need an application for managing an educational institute.
That application should provide the details of
Students
Courses
Faculty
Fee details
etc..,
pl z guide me how to write these programe
java programs
java programs i need help in understanding the whole concept of the 13 java programs that i hav...here r de programs..
int i,j,m,n;
m=Integer.parseInt(args [0]);
n=Integer.parseInt(args [1]);
System.out.print
java programs
java programs A union B, transpose of matric, denomination of a given number i need java programs for this category?
Hi Friend,
Transpose of matrix:
import java.util.*;
public class Transpose {
public
Ghost Writing
Ghost Writing
Ghost Writing is the kind of
writing when someone... of writing it. So ghostwriter
is a person who works behind the scene on a writing project
in return of certain amount. The write-ups of the writer
Blog Writing
Blog Writing
A blog, the short form of web log
is an online user... on
that. But the professionals are a better choice for writing
the blog for commercial or promotional purpose. We provides
the services of writing blogs for the commercial
Writing Actions Writing Actions
The Action is responsible for controlling of data flow within an application.
You can make any java class as action. But struts have some built in interface
and class for making action easily.
To make an Action class
Explain types of java programs
Explain types of java programs Explain types of java programs
Types of Java Programs:
Standalone Applications
Web Applications
Enterprise Applications
Console Application
Web services
how to execuite java programs???
how to execuite java programs??? I have jdk 1.6 installed in my pc.i want to execuite java programs in ms-dos for applet and without using applet.please tell me
how to execuite java programs???
how to execuite java programs??? I have jdk 1.6 installed in my pc.i want to execuite java programs in ms-dos for applet and without using applet.please tell me
Installing programs over a network
Installing programs over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
RUNNING EJB PROGRAMS
RUNNING EJB PROGRAMS how to run ejb programs using weblogic in windowsxp
how to compile programs??????????
how to compile programs?????????? "javac" is not recognised as a file name.
why??????????
Have you set your path name and class name correctly?
Anyways have a look at the following link:
Install Java
advantage of stored programs
advantage of stored programs Which of the following is an advantage of stored programs?
a) Reliability
b)Reduction in operation costs
c) The computers becoming general purpose
D) All of the above
E) None of these  
user define exception programs
user define exception programs user define exception programs
Please visit the following links:
http://www.roseindia.net/java/java-exception/user-defined-exception.shtml
http://www.roseindia.net/java/exceptions
j2ee example programs
j2ee example programs can any one tell me how to develop and execute ---------- j2ee entity beans (cmp,bmp) example,message driven bean example ,webservices example in weblogic server with (netbeans or eclipse
Web Writing
Web Writing
The art of writing for the web is far removed from writing for the print world....
Following is the prime aspect you need to keep in mind while writing for the web