Results 1 to 2 of 2

Thread: Write a C++ program that reads a floating point number

  1. #1
    FosterWood is offline Senior Member
    Join Date
    Dec 2009
    Posts
    215
    Rep Power
    3

    Default Write a C++ program that reads a floating point number

    I want to write C++ a program that reads a floating point number and then shows the right hand side digit of the integral part of the number. I tried different code but none of them worked out. Any suggestion would be highly appreciated. Thanks in advanced.

  2. #2
    MoralesMyers is offline Senior Member
    Join Date
    Dec 2009
    Posts
    202
    Rep Power
    3

    Default

    So just have a look at the coding which can make you to understand more properly.

    Code:
    #include<iostream.h>
    #include<conio.h>
    
    void main()
    {
    clrscr();
    int n r sum 0;
    cout<<"Enter any four digit number";
    cin>>n;
    while(n>0)
    {
    r n 10; 
    sum sum+r;
    n n/10;//To get coefficient
    }
    cout<<"The sum of the given four digit number is:"<<sum;
    getch();
    }

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2010, 01:30 PM
  2. Program to write prime factor of given number:
    By BrooksGray in forum Programming
    Replies: 2
    Last Post: 01-14-2010, 06:18 PM
  3. AMD moves out floating point calculations from the CPU within 3-5 years
    By Francis Seellar in forum Latest Hardware News
    Replies: 0
    Last Post: 12-01-2009, 07:24 AM
  4. Floating Point
    By techno23 in forum Programming
    Replies: 0
    Last Post: 03-26-2008, 11:23 AM
  5. Floating Point Unit
    By vandana43 in forum Processors
    Replies: 0
    Last Post: 03-19-2008, 10:43 AM

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
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48