s code example

Example 1: s

import java.util.Scanner;
class Natural_nums
{
int nat;
int sum = 0;
 public static void main(String[] args)
 {
  Scanner sc = new Scanner(System.in);
  System.out.println("count 5 natural numbers");
   int nat= sc.nextInt();
   for (nat = 1; nat>sum; nat++);
   sc.close();
 }
  void display()
  {
    System.out.println("the natural nums is"+nat);
  }}

Example 2: s

import java.util.Scanner;
class Natural_nums
{
int nat;
int sum = 0;
 public static void main(String[] args)
 {
  Scanner sc = new Scanner(System.in);
  System.out.println("count 5 natural numbers");
   int nat= sc.nextInt();
   for (nat = 1; nat>sum; nat++);
   sc.close();
 }
  void display()
  {
    System.out.println("the natural nums is"+nat);
  }}

Tags:

Misc Example