Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In
Continue with Google
or use


Have an account? Sign In Now

Sign In

Continue with Google
or use

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Continue with Google
or use

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Network Classmate Logo Network Classmate Logo
Sign InSign Up

Network Classmate

Network Classmate Navigation

  • Home
  • Article
  • Q&A
  • Guest Post
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Feed
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
Home/ Questions/Q 4976
Next
In Process
Shailendra Yadav
Shailendra YadavLevel 50
Asked: February 3, 20222022-02-03T08:25:58+05:30 2022-02-03T08:25:58+05:30

What Is The Output Of The Following Code Segment? N = 1; While (N <= 5) Cout << N << ' '; N++;?

What Is The Output Of The Following Code Segment? N = 1; While (N <= 5) Cout << N << ' '; N++;?
  • 0
  • 1 1 Answer
  • 10 Views
  • 0 Followers
Answer
Share
  • Facebook

    Related Questions

    • What Do You Mean By Https?
    • How To Check TLS Version On Aix Server?
    • How To Change Permissions For Entire Directory In Linux?
    • What Does The Tracert Command Do?
    • How To Connect Uverse Receiver To Wifi?

    1 Answer

    • Voted
    • Oldest
    • Recent
    1. Maryam Khalid Bronze
      2022-04-05T17:48:40+05:30Added an answer on April 5, 2022 at 5:48 pm

      What Is the Output of The Following Code Segment? N = 1; While (N <= 5) Cout << N << ‘ ‘; N++;

      1. 3 4 5 7
      2. 2 7 9 4
      3. 1 9 0 3
      4. 5 6 9 4
      5. 1 1 …. ans so on. 

      Answer: The correct answer to the following code when it is executed is option 5.

      The purpose to use loops is to repeat the code. Such as if you want to display the message 10 times then instead to write it over and over you can take help from the loops. Loops are efficient and also enhance the program efficient. Three types of loops exist which are listed below:

      • While loop.
      • do-while loop.
      • for loop.

      While loop:

      While loop work by determining the given condition, and it is true the while loop body code is executed. The condition was checked again till it was false, after that the loop terminated.

      The while loop syntax is:

      While (condition) {

       Loop body

      }

      do While:

      It is the extension of the while loop and the major difference is that in it the loop is executed and then the condition checked, which is the opposite of the while loop. The syntax of the do-while loop is :

      Do {

      Loop body

      }

      While (condition);

      So  do while work in the following way:

      • loop body executed and then condition verified.
      • When the condition is true the body of the do statement is executed again.
      • Condition checked again
      • The evaluation continues till the given condition is false and then the loop terminated.

      For loop:

      For loop is considered as the repetitive loop which permits you to write it when you need to execute it for a specific time. The syntax of the for loop is:

      For (i=; i<= condition; i++) {

      Body of loop

      }

      It works in the following order:

      • At first the initiation of the loop work.
      • The condition checks if it is true then the statements of the loop are executed.
      • After that, the increment in the loop happens and the loop continues.
      • The loop is terminated when the condition is false.
      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Top Members

    Shailendra Yadav

    Shailendra Yadav

    • 2k Questions
    • 52k Points
    Level 50
    Sneha Singh

    Sneha Singh

    • 2k Questions
    • 41k Points
    Level 40
    Nilay Sharma

    Nilay Sharma

    • 0 Questions
    • 33k Points
    Level 30
    • Popular
    • Comments
    • Farwa Khalid

      Half Duplex Versus Full Duplex

      • 3 Comments
    • Farwa Khalid

      What Is Split Horizon

      • 0 Comments
    • Farwa Khalid

      What Is Ping Spoofing

      • 0 Comments
    • Farwa Khalid

      What Is Wireless Isolation?

      • 0 Comments
    • Farwa Khalid

      What Is Radio Network Controller?

      • 0 Comments
    • What is Circuit Switching - Network Classmate
      What is Circuit Switching - Network Classmate added a comment […] needs to be established. It is additive into two… November 30, 2022 at 11:36 am
    • Difference Between Router And Switch - Network Classmate
      Difference Between Router And Switch - Network Classmate added a comment […] router works in the full-duplex transmission mode. However, we… November 30, 2022 at 11:36 am
    • Communication Protocols - Network Classmate
      Communication Protocols - Network Classmate added a comment […] receiver. It is two wired protocols. Rx and Tx… November 30, 2022 at 11:35 am

    • Home
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges




    Footer

    Important Links

    • Home
    • Article
    • Q&A
    • Guest Post

    Useful Categories

    • Basic Networking
    • Basic Security
    • CCNA R & S
    • CCNA Security
    • Download

    Legal Stuff

    • About Us
    • Contact Us
    • Privacy Policy
    • Terms of Service
    • User Data Policy

    Social Links

    • Facebook
    • Instagram
    • Twitter
    • Telegram
    • Linkedin

    Copyrights © 2023 Network Classmate™. All Rights Reserved.
    Designed by LeadsNut

    Manage Cookie Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage vendors Read more about these purposes
    View preferences
    {title} {title} {title}