8escs01 problem solving through programming unit-2: c programming basics



Download 0,98 Mb.
bet18/22
Sana19.05.2023
Hajmi0,98 Mb.
#940862
1   ...   14   15   16   17   18   19   20   21   22
Bog'liq
Module 2 c program

CONTROL STATEMENTS


BRANCHING STATEMENTS – IF STATEMENT
  • An if statement consists of a boolean expression followed by one or more statements.

Syntax:

Flow Diagram:

if(condition)
{
Statements;
}

CONTROL STATEMENTS


void main ( )
{
int a = 10;
if( a < 20 )
{
printf("a is less than 20\n" );
}
printf("value of a is : %d\n", a);
}
BRANCHING STATEMENTS – IF STATEMENT
Example:
#include
Output:
A is less than 20 Value of a is: 10

CONTROL STATEMENTS


BRANCHING STATEMENTS – IF..ELSE STATEMENT
  • In if…else control statement, group of statements are executed when condition is true.
  • If condition is false, then else part statements are executed.

Syntax:

Flow Diagram:

if(condition)
{
True Statements;
}
else
{
False statements;
}

CONTROL STATEMENTS


void main ( )
{
int a = 100;
if( a < 20 )
{
printf("a is less than 20\n" );
}
else
{
printf("a is not less than 20\n" );
}
printf("value of a is : %d\n", a);
}
80
BRANCHING STATEMENTS – IF..ELSE STATEMENT
Example:
#include
Output:
A is not less than 20 Value of a is: 100

CONTROL STATEMENTS


81
BRANCHING STATEMENTS – ELSE..IF STATEMENT
  • An if statement can be followed by an optional else if...else statement, which is very useful to test various conditions using single if...else if statement.


Download 0,98 Mb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   22




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish