In this syntax, though we have left both initialization and increment part, semicolon is necessary on both sides.
t=1;
for (; t<=10 ;)
System.out.println(“ “+t);
4.9 PROGRAMMING EXAMPLES
/*PROG 4.15 SUM OF THE SERIES 1-2+3-4+......*/
import java.io.*;
import java.util.*;
class JPS18
{
public static void main(String args[])
{
int n, sum = 0, t, k = 1;
Scanner sc = new Scanner(System.in);
System.out.println(“Enter the number of terms\n”);
n = sc.nextInt();
for (t = ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.