हिंदी

Given below is the program with errors in it. Identify the errors. Rewrite the program and predict the output. import java.util.*; Class Program 4 { void main()

Advertisements
Advertisements

प्रश्न

Given below is the program with errors in it. Identify the errors. Rewrite the program and predict the output.

import java.util.*;
Class Program 4
{
      void main()
      {
          int n=0, p; Scanner sc = new Scanner (System.in);
          System.out.print(" Enter n : "); n == sc.nextInt();
          for(j=1; j<=10; j++)
          p=nxj;
          System.out.println (p + "x"+j+"= "+i);
      }
}
कोड लेखन
Advertisements

उत्तर

void main()
{
     int n=0, p,j; Scanner sc=new Scanner(System.in);
     System.out.print("Enter n:"); n=sc.nextInt();
     for(j=1; j<=10; j++)
     {
        p=n*j;
        System.out.println (n +"x"+j+"="+p);
     }
}

Multiplication Table

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 1: Revision of Class 9 Syllabus - Exercises [पृष्ठ ४८]

APPEARS IN

रुपा पंडित Computer Applications [English] Class 10 ICSE
अध्याय 1 Revision of Class 9 Syllabus
Exercises | Q 6. (iv) | पृष्ठ ४८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×