PRIME NO : <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> TAKE A NUM FIND THE FACTORIAL OF A GIVEN NO USING PROMPT</title> </head> <body> <script type="text/javascript"> a= parseInt(prompt("Prime No Checker: ")); // set count as 0 c=0 // if given no is positive if(a>0){ // Loop checking divisability for(i=1;i<=a;i++){ if(a%i==0){ c=c+1; } } // count set to 2 when it is divided by 1 and itself if(c==2){ document.write(`Given No ${a} is Prime No.`); ...
SAME NAME IN CLASS METHOD AND CONSTRUCTOR, STATIC VARIABLE class Emp { String ename; int age; int sal; static int count=0; int empno; Emp() { } void Emp(String n, int a, int s) { count+=1; empno=count; ename=n; age=a; sal=s; } void show() { System.out.println("Emp_no: "+empno); System.out.println("Emp_name: "+ename); System.out.println("Emp_ag...
Comments
Post a Comment