Question

The While and if statements Write an if statementwrite the solution in c++ language

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;
int main() {
   /* if statement for n positive */
   int n = 10;
   if(n>0){
       n = n/2;
   }
   /* if else statemnt if m is odd or even */
   int m = 5;
   if(m%2==0){
       m = m-1;
   }
   else{
       m = m+1;
   }
  
   /* while statemnt when m is greater the 11 */
   int x = 10;
   while(x>11){
       x = x-5;
   }
  
   /* program to find the number of students */
   int y=1;
   while(true){
       if(y%4==3 && y%3==2 && y%5==0){
           break;
       }
       y++;
   }
  
    cout << y;
}

/* sample output

3.a

3.b 10

B. 35

*/

Add a comment
Know the answer?
Add Answer to:
write the solution in c++ language The While and if statements Write an if statement that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in c++ language 1.Re-write the following for loop statement by using a while loop statement: int...

    in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){                 sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() {    int score, highest;             //missing portion of the program             return 0;    } 1(c). Find the missing portion of the following code, so the...

  • Write in C language . Thank you Count Sheep Jojo is having problem to sleep at...

    Write in C language . Thank you Count Sheep Jojo is having problem to sleep at night. He can't fall asleep and it makes him feel tired every day. Having this problem, Jojo told his friend Bibi, and Bibi advised him to do sheep counting while he tries to sleep. Jojo decided to try using this trick for N nights, to test its effectiveness. Jojo realized that he would fall asleep if he imagined a total of 10 white sheep....

  • Language = c++ Write a program to find the number of comparisons using the binary search...

    Language = c++ Write a program to find the number of comparisons using the binary search and sequential search algorithms as follows: o Suppose list is an array of 1000 elements. o Use a random number generator to fill the list. o Use the function insertOrd to initially insert all the elements in the list. o You may use the following function to fill the list: void fill(orderedArrayListType& list) {       int seed = 47; int multiplier = 2743;                                ...

  • Eight studies are described briefly below. What research method was employed in these studies, also write...

    Eight studies are described briefly below. What research method was employed in these studies, also write the rationale of your choice of response. 1. A researcher is interested in whether drinking water right before bed increases the likelihood that children will wet the bed at night. The researcher recruits 50 5-year-old children to participate in her study. Twenty-five children are given two glasses of water two hours before their bedtime (one glass per hour) and twenty-five children are prohibited from...

  • Write in C language Identical Prime Factors Today is another bad school day for Bibi. Her...

    Write in C language Identical Prime Factors Today is another bad school day for Bibi. Her math teacher just announced that the class' exam results are horrible: more than half students don't even get a passing grade! After babbling and lecturing the class for almost an hour, the teacher finally calmed down and told the class that she is giving them a chance to fix their score. She will give a challenge, and two fastest students to answer correctly can...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list : Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard....

  • write in C language Decoration Lights Jojo is currently working in an office as a security....

    write in C language Decoration Lights Jojo is currently working in an office as a security. Every night, after everyone returned home, he needs to make sure all decoration lights in the office is turned off. The decoration lights are unique: each of them has a timer that will switch the light on or off every two seconds. The lights are also arranged so well that each two neighboring lights will have different state (on/off). As long as the timer...

  • essay

    1-In his article, "Blurring the Lines between Language and Culture", Fatiha Guessabi, a professor of Languages and Translation in the Literature and Humanities faculty at the Université de Béchar in Algeria, argues that culture is a language in itself. I agree strongly with what Guessabi mentioned in the article because languages are the ways by which we can express our culture and learn other cultures, so learning a language means learning the culture and learning the culture can be done by learning the language. Good introductory paragraph with both sentences....

  • Write a C++ code based this question n this assignment you will create three additional functions...

    Write a C++ code based this question n this assignment you will create three additional functions for each one of the data structures created in class. You will be provided with a header file which you will modify and a demo program for each data structure. If your functions are implemented correctly the demo programs should compile and execute correctly. Part 0 (Comments) 1. Over the course of the semester we have discussed comments for each data structure. Please add...

  • Question 1 (1 point) The Global English Language Job Market is Changing: What This Means for...

    Question 1 (1 point) The Global English Language Job Market is Changing: What This Means for ESL Teachers By Christie Van Tol University of Toronto TEFL Online https://medium.con accelerated/the-global-english-language-job-market-is-changing-what-this-means-for-esi-teachers-92c8d87cf8eb As the fastest-spreading language in human history, over the past several decades, English has come of age as the world's most common language. Today, English is spoken by 1.75 billion people-that's a quarter of the world's population. And this number is only set to grow. By 2020, the British Council forecasts...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT