Results 1 to 6 of 6

Thread: How to drop particular number?

  1. #1
    Join Date
    Aug 2009
    Posts
    59

    How to drop particular number?

    Hello to all,
    I am new to this forum. I recently started learning c-language. I want to drop particular number? So example if there is number like 97, is there any way to drop 7 from 97. If anyone know how to do this then please help- me.
    Thank you.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to drop particular number?

    I have written following code for you. It is very simple one. just try this code in your computer. In the following code i have create one variable knows as answers.

    int answers;
    somy[265] { 0, ... 4, 2, 3, 3, 3, 3, 3, 3, 9, 9, 9, 10 ... 255 };

    Answers = sommy[97];

    You have to run use this code in your computer to get output.

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to drop particular number?

    Hello, I am not having more knowledge about the dropping the particular number in C++. But, while searching on internet I have got the code below which will help you to achieve it. So, just make use of it and get solution for you.
    Code:
    #include <stdio.h>
    
    int Num[256];
    
    int main ()
    {
        for (int count=0; count<256; count++)
            {
                    Num[count]=(count)*0.1;
                    printf("Now you will move the decimal on the number %d one place to the left equals %d.\n", count, Num[count]);
            }
    
      return 0;
    }

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to drop particular number?

    Hey, this is quiet simple thing to do into the C++. You just need to make use of the line of the code below:
    Code:
    numbers[count]=count*0.1;
    If you make use of the code below you would not able to get solution for your problem:
    Code:
    numbers[count]=(count)*0.1;

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    Re: How to drop particular number?

    You have to just use simple maths to solve this example. Suppose if you want to remove 7 from 97 then just subtract 90 from 97. You also have to move the decimal one place to the left and since its an integer the decimal is automatically dropped.
    I think my suggestion will help you.

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: How to drop particular number?

    Hello, if you simply put the integer division by 10 on the number value then you will able to get the solution for your problem. So, just use it and solve your problem:

    Code:
    int arr[256] = ...
    
    int num = 0;
    
    // get the num 
    
    num /= 10;
    
    cout << arr[num] << endl;

Similar Threads

  1. How to remove "drop in savings" drop down from Google Chrome
    By Echa in forum Technology & Internet
    Replies: 7
    Last Post: 03-03-2012, 10:57 AM
  2. Replies: 2
    Last Post: 21-02-2012, 07:48 PM
  3. Replies: 3
    Last Post: 14-12-2011, 11:13 AM
  4. Drop In/Drop Out Split Screen in Resistance 3
    By Bubboy in forum Video Games
    Replies: 5
    Last Post: 20-08-2011, 10:48 PM
  5. How to increase number of items in drop down list of Excel
    By Chitrakala in forum Windows Software
    Replies: 8
    Last Post: 29-11-2010, 10:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,703,659.63388 seconds with 16 queries