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 / C++ / MFC
  4. C++

C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++
6 Posts 5 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 12117433
    wrote on last edited by
    #1

    If a, b and c are variable of type int. without changing the types write a program to display C = 1.5 if a is 3 and b is 2

    Richard Andrew x64R CPalliniC J _ 4 Replies Last reply
    0
    • U User 12117433

      If a, b and c are variable of type int. without changing the types write a program to display C = 1.5 if a is 3 and b is 2

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      We don't do your homework. :thumbsdown:

      The difficult we do right away... ...the impossible takes slightly longer.

      U 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        We don't do your homework. :thumbsdown:

        The difficult we do right away... ...the impossible takes slightly longer.

        U Offline
        U Offline
        User 12117433
        wrote on last edited by
        #3

        sorry...didnt mean to be rude its just a test i saw somewhere and i dont know how to do it...all i want is for you guys to tell me what its under or explain what im supposed to do not to write the program. I'm a beginner in C++...Pls guys

        1 Reply Last reply
        0
        • U User 12117433

          If a, b and c are variable of type int. without changing the types write a program to display C = 1.5 if a is 3 and b is 2

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          #include
          int main()
          {
          int a,b,c;
          if (a==3 && b==2) printf("C=1.5\n");
          return 0;
          }

          :laugh:

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • U User 12117433

            If a, b and c are variable of type int. without changing the types write a program to display C = 1.5 if a is 3 and b is 2

            J Offline
            J Offline
            Jochen Arndt
            wrote on last edited by
            #5

            For a precision of one-tenth:

            printf("C = %d.%d\n", a / b, abs(((10 * a) / b) % 10));

            1 Reply Last reply
            0
            • U User 12117433

              If a, b and c are variable of type int. without changing the types write a program to display C = 1.5 if a is 3 and b is 2

              _ Offline
              _ Offline
              _Superman_
              wrote on last edited by
              #6

              I guess the question is hinting type casting[^].

              «_Superman_»  _I love work. It gives me something to do between weekends.

              _Microsoft MVP (Visual C++) (October 2009 - September 2013)

              Polymorphism in C

              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