C & micro & fpga
1.67K subscribers
187 photos
9 videos
98 files
39 links
Admin : فرهاد ناصری زاده
@farhad_naserizadeh
@farhad3412
آموزش زبان C و میکروکنترلرها
لینک گروه

https://t.me/joinchat/HU0aoFCv4MTCt4fz0h6AZg
کانال های مرتبط با این کانال :
@raspberry_python
@micropython_iot
@ai_dsp
Download Telegram
❇️ مثال های کاربردی برای printf

#include <stdio.h>

int main()
{
printf ("Characters: %c %c \n", 'a', 65);

printf ("Decimals: %d %ld\n", 1977, 650000L);

printf ("Preceding with blanks: %10d \n", 1977);

printf ("Preceding with zeros: %010d \n", 1977);

printf ("Some different radices: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100);

printf ("floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416);

printf ("Width trick: %*d \n", 5, 10);

printf ("%s \n", "A string");

return 0;
}

OUTPUT:

Characters: a A

Decimals: 1977 650000

Preceding with blanks: 1977

Preceding with zeros: 0000001977

Some different radices: 100 64 144 0x64 0144

floats: 3.14 +3e+000 3.141600E+000

Width trick: 10

A string

🔰 @c_micro
❇️ مثال های کاربردی برای scanf


#include <stdio.h>

int main ()
{
char str [80];
int i;

printf ("Enter your family name: ");

scanf ("%79s",str);

printf ("Enter your age: ");

scanf ("%d",&i);

printf ("Mr. %s , %d years old.\n",str,i);

printf ("Enter a hexadecimal number: ");

scanf ("%x",&i);

printf ("You have entered %#x (%d).\n",i,i);

return 0;
}

OUTPUT :

Enter your family name: Soulie

Enter your age: 29

Mr. Soulie , 29 years old.

Enter a hexadecimal number: ff

You have entered 0xff (255).

🔰 @C_micro