You are on page 1of 8

:

.

.
.
.

.

.


.
.
):(printf

.
.
. .
):(scanf

.
.
>#include <stdio.h
)( main
{
;int a,b,c

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

;)printf(enter tow number :=> \n


;)scanf(%d \n,&a
;)scanf(%d \n,&b
;c=a+b
;)printf(%d,c
;return 0
}

.

.
)(scanf
);) (scanf(%d,&a
) (%d
) (integer ) (&a )
(scanf )&(

)&(
.


) (scanf
. :
;)Scanf(%d %d , &a,&b


) (%f )
(%c .
:
).(if



.
)If (expression
;Statement

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

) (expression )(statement
.
) (statement ) (if .
.
>#include<stdio.h
)( main
{
;int a
;)"printf("enter a number greater than 10:\n
)&( *scanf("%d",&a); /
*/
*if (a <10) /

*/
;)"printf("the number you entered is not greater than 10\n
;return 0
}
) (scanf
).(a
) (10 )(10

.

) (10 .
. ) (5
) (10 ) (if
) (5<10 ) (5 ) (10

)(the number you entered is not greater than 10
) (10 ) (10
).(10

.

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

) (10
) (10 . )
;)" (printf("welcome in my pro
. .

.
:
)If (expression
{
;statement1
;statement2
..
..
;statement n
}

)} {( .
.
):(if ---- else

:
)If (expression
;Statement1
Else
;Statement2

{( .
)}

) (10 ) (10
).(10 :
>#include<stdio.h
)( main
{
;int a

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

;)"printf("enter a number greater than 10:\n


)&( *scanf("%d",&a); /
*/
*if (a <10) /

*/
;)"printf("the number you entered is not greater than 10\n
else
;)"printf("the number you entered is greater than 10\n
;return 0
}
.
.(if
elseif
elseif
) else
:
)If (expression
;Statement1
Else
)if (expression
;Statement2
Else
;Statement3

.
>#include<stdio.h
)( main
{
;int a
;)"printf("enter a number greater than 10:\n
;)scanf("%d",&a
*if ( a>=0 && a<=10) /

(&&)*/

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

;)"printf("the number you entered is between 0 and 10:\n


else
*if (a>10 && a<=20) /

(&&)*/
printf("the number you entered is between 11 and
;)"20:\n
else printf("the number you entered is greater than
;)"21.\n
;return 0
}

):(switch


.
:
)Switch (expression
{
case constant 1:
statements
;break
case constant2:
statements
;break
case constant n:
statements
;break
default:
;statement
}

. ) (case constant
)(statement

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

) (break .
.
) (default:
.

. :
>#include<stdio.h
)( main
{
*int num1,num2,result;/
*/
*char ch; /
) (+
*/
*/ ) (+ *printf("enter + to add numbers:\n");/
) (- *printf("enter - to subtract numbers:\n");/
*/
*/ *scanf("%c",&ch); /
)switch (ch
{
case '+':
;)"printf("enter the first number:\n
*/ *scanf("%d",&num1);/
;)"printf("enter the second number:\n
*/ *scanf("%d",&num2);/
;result=num1+num2
;)printf("result=%d +%d = %d",num1,num2,result
;break
case '-':
;)"printf("enter the first number:\n
*/ *scanf("%d",&num1);/
;)"printf("enter the second number:\n
*/ *scanf("%d",&num2);/
;result=num1-num2
;)printf("result=%d -%d = %d",num1,num2,result

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

;break
default:
;)"printf("unknown option:\n
;break
}
;return 0
}
) (+ ) (- )
(unknown option .

.
)(The-oNe
:
The-one@pharaonics.net
OR
The_o0ne@hotmail.com
OR
The_o0one@yahoo.com

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

You might also like