Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

kanigayan

  • 2 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
    • 2 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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    this code runs just fine

  3. kanigayan
    • 2 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
    • 2 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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah :) thanx

  6. Shadowys
    • 2 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.

    Search OpenStudy
    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.