#include<stdio.h>
#include<conio.h>
void main()
 {
  float a=6;
  clrscr();
  printf("%d",a);
  getch();
 }

here the output is some garbage value.here the error lies in %d instead of %f.for float value the identifier is f.is this the proper answer of my question?

Yes that is the problem.

Try replacing "%d" with "%f". "%d" expects an integer. Also, 6 is not a float. Might want to change that to 6.0.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.