Program of React-JS to check prime number

0

 


Program of React-JS to check prime number using constant object?

import React from "react";

export class Prime extends React.Component

{

    state = {

        num: 9,

        i: 2,

        s:null

      };

       constructor()

   {

        super();

       }

   render()

   {

    const { num } = this.state;

    for(this.state.i=2;this.state.i<num;this.state.i++)

    {

        if(num%this.state.i==0)

        {

            this.state.s = "not prime";

            break;

        }

    }

    if(num==this.state.i)

    {

        this.state.s = "prime";

    }

    return(

       <div>

          

       <p>{this.state.s}</p>

       </div>

       )

   } 

}

ASSIGNMENT OF REACT:-

WAP to create a mark sheet using five different subjects with the following conditions?

1)  all subject marks should be 0 to 100?

2)  If only one subject mark is <33 then the student will supply.

3)  If all subject marks are>33 then the student pass and display division with percentage?

4)  if the minimum of two subject marks is <33 then the student will fail.

5)  if the student is suppl and the mark is >28 then five bonus marks will be added then the student will pass by grace and grace subject name.

6) display distinction subject name

7) display suppl subject name


Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)