НАРЕДБА ЗА ИЗБОР ОД ДВЕ МОЖНОСТИ (IF-ELSE)– ПРАШАЊА:
Што ќе се отпечати со следниот дел од програмскиот код?
a) int a=10;
int b=8;
if(a>b)
cout<<a<<endl;
else
cout<<b<<endl;
b) int a=10;
int b=8;
if(a<=b)
cout<<a<<endl;
else
cout<<b<<endl;
c) int a=5;
int b=3;
if(a>b)
{
cout<<a+b<<endl;
cout<<a-b<<endl;
}
else
cout<<b<<endl;
d) int a=5;
int b=3;
if(a<=b)
{
cout<<a+b<<endl;
cout<<a-b<<endl;
}
else
cout<<b<<endl;
e) int a=5;
int b=3;
if(a<=b)
{
cout<<a+b<<endl;
cout<<a-b<<endl;
}
else
{
cout<<a/b<<endl;
cout<<a%b<<endl;
}
f) int a=5;
int b=3;
if(a>b)
{
cout<<a+b<<endl;
cout<<a-b<<endl;
}
else
{
cout<<a/b<<endl;
cout<<a%b<<endl;
}
g) int a=5;
int b=3;
if(a>b)
{
cout<<a+b<<endl;
cout<<a-b<<endl;
}
else
cout<<a/b<<endl;
cout<<a%b<<endl;
h) int a=5;
int b=3;
if(a>b)
cout<<a+b<<endl;
cout<<a/b<<endl;
cout<<a%b<<endl;
i) int a=5;
int b=3;
if(a<b)
cout<<a+b<<endl;
cout<<a/b<<endl;
cout<<a%b<<endl;
No comments:
Post a Comment