C program for different input/output Formats - With Output

#include<stdio.h>
#include<conio.h>

void main()
{
     int num=123,num2;
scanf(“%2d”,&num2);
printf(“First two digits are : %d”,num2);
printf(“\n%d”,num);
printf(“\n%5d”,num);
printf(“\n%0.5d”num);
float number=123.4567;
printf(“\n %6.3f”,number);
printf(“\n %6.3e”,number);

getch();

}

OUTPUT :
First two digits are : 123
  123
00123
123.456

1.2345e+02
Share on Google Plus

About Akash Manhas

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment