| 1. |
Program in java to print series S=2\1+4\3+6\5...n terms |
Answer» Question:Write a program in java to print the SERIES upto n terms_
Answer:IMPORT java.util.*; public class Series { public static void main(String args[]) { Scanner in =new Scanner(System.in); int a,b,n; float S=0.0; System,out,println("ENTER the value of n"); n= in.nextInt(); for(a=2;a<=n;a=a+2) for(b=1;b<=n;b=b+2) { S= S+(a/b); System.out.println("The series is="+S); } } } For more java programmings follow the GIVEN links, as I have solved earlier: |
|