Hi All,
I have 2 idea...
1)
main()
{
int j, i = 1234;
for ( j = i; j > 100; j /= 10)
;
printf("%d\n", j);
}
2)
main()
{
int i = 1234;
char buff[256];
snprintf(buff, 256, "%d", i);
printf("%c%c\n", buff[0], buff[1]);
}
Thanks & Regards,
Rajath N R
--- On Mon, 9/1/08, prakaashganth d <[EMAIL PROTECTED]> wrote:
From: prakaashganth d <[EMAIL PROTECTED]>
Subject: [c-prog] Format Specifier in C
To: [email protected]
Date: Monday, September 1, 2008, 2:02 AM
Hi People,
I have a doubt in C program.
Suppose i have declared int i = 1234;
If I want to print only 12 (first 2 digits) using printf statement, please
suggest how do i implement it.
Regards,
prakash.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]