Q:

Java - for Statement

0

This Program is used to demonstrate the for statement.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.io.*; 

class ssvfor 
{ 
public static void main(String arg[]) throws IOException 
{ 
System.out.print("\nEnter the Number : "); 

DataInputStream dr = new DataInputStream(System.in); 

String t; 

t = dr.readLine(); 

int i,n,f; 
f=1; 

n = Integer.parseInt(t); 

for(i=1;i<=n;i++) 
{ 
f = f*i; 
} 
System.out.println("\nFactorail of Given number "+n+" is : "+f); 

} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now