Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

kanigayan

  • 3 years ago

An if statement mayor may not have an else clause, but an else clause must be a part of an if statement. is it true or false ?

  • This Question is Closed
  1. Shadowys
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    #include <iostream> using namespace std; int main() { int list[]={4,5,6,7,8,9}; int i,j; for (i=0;i<6;i++) { for (j=0;j<list[i];j++) { if (j*j==list[i]) { cout<<list[i]<<"-->"<<j<<"F\n"; cout<<list.size(); } } } }

  2. Shadowys
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    this code runs just fine

  3. kanigayan
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i mean that statement is write or wrong , it's wrong no?

  4. Shadowys
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    it's right, actually, since the if clause automatically generates an else clause (that does nothing) but it won't be same vice versa

  5. kanigayan
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah :) thanx

  6. Shadowys
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    you're welcome :)

  7. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy