Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. c#

c#

Scheduled Pinned Locked Moved C#
csharphelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10578142
    wrote on last edited by
    #1

    wap to divide a number by another no. and handle all possible exception plz help me

    L C 2 Replies Last reply
    0
    • U User 10578142

      wap to divide a number by another no. and handle all possible exception plz help me

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Not very clear. Anyway assuming you have `int`s, there are two bad cases: 1) anything divided by zero. 2) int.MinValue / -1 Just test both. if (y == 0 || y == -1 && x == int.MinValue) { // do whatever you have to do but don't divide x by y } else { int d = x / y; // this is safe now }

      1 Reply Last reply
      0
      • U User 10578142

        wap to divide a number by another no. and handle all possible exception plz help me

        C Offline
        C Offline
        cvogt61457
        wrote on last edited by
        #3

        Hmmm.... Can you be a little more vague?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups