This is the problem:

Create a program that will create in adding of multiple exxpressions. Use while, do while and for loop.

Here is how the output should be:

(You should be enterring a number first)
*for example I enterred number 5

1 + 4 = 5
2 + 3 = 5
3 + 2 = 5
4 + 1 = 5
5 + 0 = 5


happygeek commented: lazy -3

Recommended Answers

All 5 Replies

Why should anyone here do your homework for you?

Show us what you have already done (including the code you have so far) and where you are getting stuck, then people will be more inclined to take you seriously and offer their time to help you out.

Oh and read the rules, especially this one: "Do provide evidence of having done some work yourself if posting questions from school or work assignments"

yes bro, you should give yourself a try even if you know that you're gonna make mistakes, then when you stuck we will help you, this program seems easy , anyone can do it.

Agree with everyone above! Maximum if u need help, heres a hint for u

Use a for loop starting from 0 and run till ur number
cout<<i<<" + "<< n-i<<" = "<<n;

where n is till where u want the loop to run(i.e 5 in ur example) and 'i' is the variable of the for loop!

P.s- Technically i just solved it for u :) Hope u can do the needful atleast now...

cout<<i<<" + "<< n-i<<" = "<<n;

This is the C forum not C++


printf("%d + %d = %d",i,(n-i),n);

also don't do the OP's work for him... it's not your homework
let him learn by himself, we're only here to guide/teach him

Sorry, was just trying to help. I do get ur point ! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.