[go: up one dir, main page]

0% found this document useful (0 votes)
21 views2 pages

DataTypes Format

Uploaded by

chemistm64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

DataTypes Format

Uploaded by

chemistm64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

 % signifies the beginning of a format specifier.

 0 indicates that zero-padding should be used.


 * specifies that the width of the field should be determined dynamically at runtime.
 d specifies that the argument being formatted is an integer.
Variable format

Date
Types Code Function How to be implemented
Format
%d just to let the IDE understands printf("hello my number is : %d%d \
that there is an integer will be n", 10, 20);

written now 😊
output should be :
Hello my num is : 1020
printf("Hello My Number is :
Int %0*d Just to let the IDE prepare to %0*d \n",6, 12);
receive, expect an int number with
known width determine by zero output should be :
Note that : u can not modify the 000012
zero.
%.*f  The * in %.*f indicates that printf(" let us try : %.*f",
3, 1.1210012);
the precision of the
floating-point value
should be determined
dynamically at runtime. output should be : 1.121
 The precision value is
passed as an additional
argument to printf.
 The f specifies that the
argument being formatted
Float is a floating-point value.

%.3f  The .3 in %.3f specifies printf("\nhey let us test the


fixed one : %.5f \n", 3.1415921);
a fixed precision of 3
decimal places. output should be
 The f specifies that 3.14159

the argument being


formatted is a
floating-point value.
‫‪String‬‬ ‫ملحوظه االسترينج علشان تدخله استرينج الزم نحطه في فريبل‬
‫من نوع كركتر‬
‫‪%s‬‬ ‫‪printf("MOHAMED SALEH %s ",‬‬
‫;)‪name‬‬

‫‪out put‬‬
‫‪mohamed saleh nasr‬‬
‫‪C‬رقم‪%‬‬ ‫عمل عدد فراغات‬ ‫‪printf("MOHAMED‬‬
‫;)'‪SALEH %6c ", 'ah‬‬
‫‪mohamed saleh‬‬ ‫‪ah‬‬

‫يبقى في عالمه في الكود علشان تعرفنا ان ده ‪Note :‬‬ ‫علشان ال تنسى الزم‬
‫تفتكر الرقم بعد الدوت الى هو استار معناه بيشير‬ ‫فلوت وكمان علشان‬
‫منه فلو سيبنا االستار يبقى الزم نكتب الرقم بعد‬ ‫لكام رقم هتاخد‬
‫يبقى الزم نحط مكان االستار الرقم ال هيتحسب من بعد‬ ‫االسترينج لو شلناه‬
‫العالمه‬

You might also like