Trending ▼   ResFinder  

ICSE − Q & A

ICSE
Indian Certificate of Secondary Education (ICSE), New Delhi
+Fave Message

Ask a Question

Answer a Question!

ResFinder - Thousands of Practice Papers

Is this the correct format of writing a number program using method? , if not send me the format Thank you... 

import java.util.*;
class Niv
{
    public static void main(String args [])
    {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter a number");
        int n=in.nextInt();
        int num=n;
        int sum=sumOfDigits(n);
        
        if(num%sum==0)
        System.out.println(num+" is a Niven number");
        else
         System.out.println(num+" is not a given number");
          
         
        }
        
        
        public static int sumOfDigits(int g)
        {
            int sum=0;
            while(g>0)
            {
            int rem;
            rem=g%10;
            sum=sum+rem;
            g=g/10;
        }
        return sum;
        
        
        
    }
}
asked by Uttam Soren (uttamsoren1735) 6 years ago
1
Anyone have together with biology notes...pls share with me drive link or mai me..(CH:reproduction, nervous system and genetics..)


..pls
asked by Devansh Tripathi (drdevansh) 6 years ago
2
Why is an object called a static data member??
asked by Aayush Joshi (aayushjoshi) 6 years ago
1
can anyone tell me the problem with this snippet as I am not getting my output.
Purpose:
to enter 10 names of cities and their populations:
import java.util.Scanner;
class cit_pop
{
    void main()
    {
        Scanner in=new Scanner(System.in);
        System.out.println("Please enter the names of 10 cities and their populations:");
        int p[]=new int[10];
        String c[]=new String[10];
        for(int i=0;i<10;i++)
        {
            System.out.println("Please enter the names of cities and their populations:");
            
            c[i]=in.nextLine();
            p[i]=in.nextInt();
        }
asked by Ashutosh Dash (ashutosh_dash) 6 years ago
4

+ 2 more questions by ashutosh_dash  

anyone who can upload physical education specimen paper 2018...
asked by Ayaan Mansuri (crq7) 6 years ago
2
can we use recursion?
asked by Hatake Kakashi (jatintara) 6 years ago
3
Do we need to write comments and variable description in class programs (where the variables are already described in the question)? Pls tell.
asked by Gargie D'souza (gar_d02) 6 years ago
2
Difference between dynamic and static binding ?
asked by Akshay (akshay0072001) 6 years ago
1
differene between error and exception
asked by Rtstud (mdarfath) 6 years ago
1
This is an extremely stupid question:



Can we use gel pen in the boards or only a ballpoint pen?
asked by Pavan K Srinivasan (throwaway) 6 years ago
7

<< Prev

    Page 488    

Next Page >>

ICSE chat

© 2010 - 2024 ResPaper. Terms of ServiceContact Us Advertise with us