First time here? Checkout the FAQ!
+1 vote

just confused in these things-

we are perfoming a/b

if we have two INT variables a=6 and b=2

in which scenario we will get answe as 

  • 3
  • 3.0

similarly ,if they are float then when will we get 

  • 3
  • 3.0

if we have two floats as a=3.2 and b= 1.1

then what will be the answer on division

asked in Programming by Veteran (14.8k points) 15 153 318 | 38 views

for integer variables it prints as 3 only not 3.0

for foat variables it prints as 3.000000 

if we declare like  printf("%.2f",a);  // upto 2 decimal places.

foat a=3.2

float b=1.1

float c=3.2/1.1

printf("%.2f",c);   // o/p as 2.90

in case of float,it wont print 3 anyhow??

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23706 Points

  2. Bikram

    17298 Points

  3. Habibkhan

    9336 Points

  4. srestha

    6566 Points

  5. Debashish Deka

    5478 Points

  6. jothee

    5188 Points

  7. Sachin Mittal 1

    4910 Points

  8. joshi_nitish

    4514 Points

  9. manu00x

    4158 Points

  10. sushmita

    4098 Points

Recent Badges

Verified Human Terminator
Verified Human maheshtheng
Nice Answer Ahwan
Renewal Ahwan
Notable Question pranab ray
Notable Question Tuhin Dutta
Great Question jothee
Ancestor santhoshdevulapally
Nice Question Pradip Nichite
Famous Question smartmeet
27,447 questions
35,307 answers
33,549 users