Simple program to print integer and float value.

                 In C programming to print the value of integer or float we use printf(); function with format specifiers %d and %f for integer and float respectively. Format specifier using in between the double-cot. like "%d". There are many other format specifier to print different data-type as follows.

                                       char     -  %c
                                       double -  %lf
                                       long int -  %ld
                                       string    -  %s

Syntax:
          printf("%d",<variable name>); // For integer value.
          printf("%f",<variable name>); // For float value.




Source Code To display integer and float.


#include<stdio.h>

void main()
{

int no1;
float no2;

no1=12;
no2=24.56;

clrscr();

printf("%d",no1); //to print integer value
printf("\n"); // \n is for the new line.
printf("%f",no2); // to print float value.

getch();

}





c program to print integer value and float value

Download


0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.