Monday, 6 January 2020

HAY THANK FOR VISIT

<<<<<<LET'S START WITH ANOTHER QUESTION>>>>>>>>>>>>>

QUESTION --- TO CHECK THAT THE GIVEN NUMBER IS PERFECT NUMBER OR NOT.

class Perfect
{
    void main(int n)
    {
        int f=0;
        for(int i=1;i<n;i++)
        {
            if(n%i==0)
            f=f+i;
        }
        if(f==n)
        System.out.println("perfect number");
        else
        System.out.println("not a perfect number");
    }
}


INPUT--6
OUTPUT--


HAY THANK FOR VISIT



<<<<<<<LET's START WITH ANOTHER QUESTION>>>>>>>>


QUESTION---WRITE A PROGRAM TO PRINT THE FACTORIAL OF A NUMBER..



class Factorial
{
    void main(int n)
    {
        int m=1;
        for(int i=1;i<=n;i++)
        {
            m=m*i;
        }
        System.out.println("factorial of the number is "+m);
    }
}







INPUT--------5
OUTPUT-------------




HAY THANK FOR VISIT

<<<<<<<LET's START WITH ANOTHER QUESTION>>>>>>>>

Question:-PRINTING THE TABLE OF THE GIVEN NUMBER...


class Table
{
    void main(int n)
    {
        for(int i=1;i<=10;i++)
        {
            System.out.println(n*i);
        }
    }

}

INPUT----2
OUTPUT:----------------

HAY THANK FOR VISIT

<<<<<<<LET's START WITH ANOTHER QUESTION>>>>>>>>>>>>>>>

Question--Write a program to read the month number and print the name of that month.


import java.util.*;
class Month
{
    void main()
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("entre the month number");
        int n=sc.nextInt();
        switch(n)
        {
            case 1:
            System.out.println("January");
            break;
            case 2:
            System.out.println("February");
            break;
            case 3:
            System.out.println("March");
            break;
            case 4:
            System.out.println("Aprail");
            break;
            case 5:
            System.out.println("May");
            break;
            case 6:
            System.out.println("June");
            break;
            case 7:
            System.out.println("july");
            break;
            case 8:
            System.out.println("August");
            break;
            case 9:
            System.out.println("September");
            break;
            case 10:
            System.out.println("October");
            break;
            case 11:
            System.out.println("November");
            break;
            case 12:
            System.out.println("December");
            break;
            default:
            System.out.println("invalid input");
        }
    }
}
     
INPUT----5
OUTPUT----MAY


        IF THIS BLOG IF USEFUL FOR YOU THEN SHARE IT WITH YOUR FRINDS AND LIKE COMMENT ON THIS BLOG HOW IS THIS BLOG..............
HAY THANK FOR VISIT
TODAY I AM GIVING A SMALL PROGRAM FOR CHECKING THE GRATEST AMONG TWO NUMBERS.

<<<<<<<<<<<HAY THERE LETS START>>>>>>>>>
QUESTION :-Write  a program to  read two numbers and find the gratest number.

class abc
{
    void main(int a,int b)
    {
        if(a>b)
        System.out.println("the grater no is"+a);
        else
        System.out.println("the greater no is"+b);
    }
}

Tuesday, 30 October 2018

A program of java using scanner class

Question:-Write a program to create a class employ and input number of days worked and rate perday Calculate wadges of the
employ and print all the details.

LET'S START OUR PROGRAM.

import java .util.*;
class employ
{
void main()
{
Scanner sc=new Scanner(System.in);//creating of object
System.out.println("enter per day rate of employ");
int r=sc.nextInt();
System.out.println("enter number of working day of employ");
int d=sc.nextInt();
int wedges=r*d;
System.out.println("wedges of employ is");
System.out.println(wedges);
}
}



THIS IS THE PROGRAM 
DO NOT FORGOT TO SHARE,LIKE,COMMENT ON MY VLOG.

THANKS FOR VISIT





A small java program using scanner class

A small java program for any platform not only for blue j

This is the program to calculate two variable given by user by using Scanner class.

import java.util.*;
class add
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("enre any two digits");
int n=sc.nextInt();
int n1=sc.nextInt();
int s=n+n1;
System.out.println(s);
}
}

this program will run in any platform without using blue j

Procedure i will give latter 

but ,dont forgot to like and share my vlog

THANKS FOR VISIT






Program(python):-Find duplicates in an array (Geeks for geek problem)

QUESTION:- Given an array  a  of size  N  which contains elements from  0  to  N-1 , you need to find all the elements occurring more than o...