what is the output of the following program?
#include<stdio.h>
void main()
{
float x=1.1;
while(x==1.1)
{
printf("\n%f",x);
x=x-0.1;
}
}

Answer Posted / battini.laxman

No output.Loop will not execute atleast once. because
compiler will treat real constant as double. So real
constants will not store exactly equal to that constant
value but appproximately equal to that constan in binary
format. So float value and doule value storing
approximately equal but not exactly.small difference will
be there.so condition will fail at first time.So loop will
not execute atleast once.

Is This Answer Correct ?    17 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use namespace feature?

590


What is the advantage of a random access file?

646


What is the best way of making my program efficient?

575


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1482


What are the two forms of #include directive?

653






GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

1441


Write a program to find factorial of a number using recursive function.

660


What is the heap in c?

649


In which layer of the network datastructure format change is done

1445


What is a program flowchart and how does it help in writing a program?

677


Explain the properties of union. What is the size of a union variable

728


Is javascript based on c?

601


In C programming, what command or code can be used to determine if a number of odd or even?

633


Sir i need notes for structure,functions,pointers in c language can you help me please

1959


Write a C program in Fibonacci series.

645