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

hi guys these are two answers to the disarmium question everyone has been bothered about- without using string functions
import java.util.Scanner;
public class disarmy1
{
    void hello()
    {  Scanner in = new Scanner(System.in);
        System.out.println("enter the number ahole");
        int s = in.nextInt();
        int a = s;
        int b=s;
        int d=0;//to find the digits
        int c=0;//to count the number of digits
        int i,e=0,sum=0;
        while(s>0)
        {  d= s%10;
            c++;
            s=s/10;
        }
        for(i=c;i>=1;i--)
        { 
            
            
          e= a%10;
           sum = sum+ (int)(Math.pow(e,i));//since i is equal to number of digits
            a=a/10;
        
       }
       if(sum==b)
       System.out.println("disarmium number");
       else
       System.out.println("not");
    }
}
//THIS IS THE SECOND ANSWER TO THE QUESTION WHICH IS A LITTLE HARDER TO COPREHEND 
import java.util.Scanner;
public class disarmy2
{
    void hello()
    {
        //this is using arrays
         Scanner in = new Scanner(System.in);
        System.out.println("enter the number ahole");
        int s = in.nextInt();
        int n =s;
        int q=s;
        int d=0;
        int i;
        int c=0;
        int x=0;
        int sum=0;
        while(s>0)//to find the number of digits the number has
        {d = s%10;
            c++;
            s=s/10;
        }
        int a[]= new int[c];
        for(i=0;i<c;i++)//to put all these digits into an array
        {
            x=n%10;
            a[i]= x;
            n=n/10;
        }
        for(i=c-1;i>=1;i--)//taking array from the last element and adding the power of index+1 of that number to sum
        {
            sum = sum+ (int)Math.pow(a[i],i+1);
        }
        if(sum==q)
        System.out.println("disarmium");
        else
        System.out.println(" not");
    }
    
}
asked by Sankhya Gowda (taankkkkk) 5 years ago
2
what is use of     if (num == 0) 
            { 
                num = sum; 
                sum = 0; 

in magic number code
asked by Ansh Anand (teleansh) 5 years ago
0

+ 3 more questions by teleansh  

Guys cant we use string functions and stuff for Disarium number, Other types of numbers?
asked by Aquaman- King of the Seven Seas (shauns) 5 years ago
2
This is for all.

Can everyone please decribe how you he/she divide his/her time for completing the paper.

and what would you do additional in your copy to fetch good marks from the examiner.
asked by Bitthal Maheshwari (bitthal04) 5 years ago
1

+ 1 more questions by bitthal04  

Do we have to do operators associavity coz it's not there in APC
asked by Tubhyam Mehta (tirth7683) 5 years ago
1
Good quality computer question paper solve to increase your knowledge

Paper 1. https://drive.google.com/file/d/19kSSQ1n-EVh9SV6YBnM_tvhKBjyFp9Hz/view?usp=drivesdk



Paper 2 https://drive.google.com/file/d/1xGWq2bKcsrrAisyE3zWMxbjY22tpUbB7/view?usp=drivesdk

I hope u can 100
asked by Annhaliator (laxyone) 5 years ago
3
Design a class to Overload ......

Do we need to write main( ) ? If yes, do we have to get values from the user, or can we put in our own values? Getting from the user will be prettty loong..
asked by Prateek Pradhan (prateek235) 5 years ago
2
why is (index of )answer -1 if character is not found in string ?
asked by Not productions (pranav55) 5 years ago
3
Can anyone help me with the code of my previous question.... I'll tell the logic for that as well..... 
The logic is: If you take the numerical value of the letters, you find that they are in fibonacci sequence. And the second half is reverse fibonacci. Remember to take the numeric value instead of ASCII value. Good luck coding!
asked by Mr. Mathematics (aditya_bandaru) 5 years ago
3
import java.util.*;
class isogram
{
    public static void main()
    {
        Scanner ayush=new Scanner (System.in);
        System.out.println("Enter a string");
        String s=ayush.nextLine();
        s=s.toUpperCase();String w="";String s1="";char ch1,ch2;int f=0;
        
        s=s+' ' ;
        int l=s.length();
        for(int i=0;i<l;i++)
        {
            char ch=s.charAt(i);
            if(ch==' ')
            {
                for(int j=0;j<w.length();j++)
                {ch1=w.charAt(j);
                    for(int k=j+1;k<w.length();k++)
                    {ch2=w.charAt(k);
                       if(ch1==ch2)
                       f++;}
                       if(f>0)
                       continue;
                       else
                       s1=s1+w+" ";
                    }}
                  else
                  w=w+ch;
                  w="";}
                  System.out.println("the stirng after manipulationm"+s1);}}

can u guys helps me with his program it is the answer to rikhil question 
i m not getting any syntax error but still no output
asked by Ayush Agarwal (qwertyuiop12345678901234567890) 5 years ago
4

<< Prev

    Page 452    

Next Page >>

ICSE chat

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