English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Give a logical, arithmetic and Data Structure solution

2007-02-25 12:35:54 · 3 answers · asked by Somenath D 1 in Computers & Internet Programming & Design

This question needs to be answered in C language

2007-02-25 13:21:36 · update #1

3 answers

It depends on the language, but let's say you want to do that in C++, C#, or java. Here are two ways:

1) if (x == 1 || x == 0) or if (x == 1) { } else { }

2) if (x) {FIRST } else {SECOND } here if x is equal to 1 then the "FIRST" block of code is executed, but if x is 0 then the "SECOND" bloclk of code is executed.

2007-02-25 13:21:25 · answer #1 · answered by Silver_Sword 3 · 0 0

easy srry not in c

#include
using namespace std;

int main(){

int a;
cout << "whats the value of a:";
cin >> a;
cout << endl;
if( (a = 0) || (a = 1)){
statement
}
return 0;
}

2007-02-25 13:47:49 · answer #2 · answered by Best Helper 4 · 0 1

In what language?

If x = 0 or x = 1
then
....
end if

etc., etc.

2007-02-25 13:03:10 · answer #3 · answered by Elija Smith 1 · 0 0

fedest.com, questions and answers