CrazyEngineers
  • #include main() { Float a,b,sum; a=3.087; sum=a+b; printf("sum=%f",sum); }

    Devika Tulsidas

    Devika Tulsidas

    @devika-B7u8yN
    Updated: Oct 26, 2024
    Views: 1.3K

    Actully i was getting the ans as 11 so.iwas having the doubt that if we dont give the value of b will it consider itself n how

    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Kaustubh Katdare

    AdministratorSep 22, 2018

    #-Link-Snipped-#  - I'm not sure what you're trying to do. If you haven't define 'b', it's not going to add up to a.

    The output of the following program -

    #include <stdio.h>

    main() 

    { 

        float a,b,sum; a=3.087; 

        sum=a+b; 

        printf("sum=%f",sum); 

        return 0;

    }

    is 3.087000 

    I'm not sure why are you getting 11. Did you write the entire program? Could you check and post again? 

    Are you sure? This action cannot be undone.
    Cancel
  • Devika Tulsidas

    MemberSep 22, 2018

    Sorry im getting 3.087000.i dont know what mistake i have done that time

    Are you sure? This action cannot be undone.
    Cancel
  • Jayt aw

    MemberSep 24, 2018

     try to initialize b variable with 0, may be junk values causing the problem.

    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register