To print the sum of n given numbers Posted on 11:25 by Unknown with No comments class Pro15 { public static void main(String arg[]) { int i,a=0,n; n=Integer.parseInt(arg[0]); for(i=1;i<=n;i++) { a=a+i; } System.out.print("sum is "+a); } } Email ThisBlogThis!Share to XShare to Facebook
0 comments:
Post a Comment