printf double and float with %f and scanf for float %f double %lf
This commit is contained in:
		
							
								
								
									
										18
									
								
								c-basic/d-f.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								c-basic/d-f.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
  float f;
 | 
			
		||||
  double d;
 | 
			
		||||
 | 
			
		||||
  printf("enter a float number: \n");
 | 
			
		||||
  scanf("%f", &f);
 | 
			
		||||
 | 
			
		||||
  printf("enter a double number: \n");
 | 
			
		||||
  scanf("%lf", &d);
 | 
			
		||||
 | 
			
		||||
  printf("f = %f, d = %f \n", f , d);
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user