IT Community - Software Programming, Web Development and Technical Support

Solve the problem, if you possible?

This is a discussion on Solve the problem, if you possible? within the C and C++ Programming forums, part of the Software Development category; Hello all, I want to Print the output like this, "Addition of <value of variable> + 1 = <...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 11-17-2007, 01:16 AM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 67
velhari is on a distinguished road
Send a message via AIM to velhari
Question Solve the problem?

Hello all,

I want to Print the output like this,

"Addition of <value of variable> + 1 = <sum of (variable+1)>"

For Example:-
Input:-
variable = 5

output will be...
Addition of 5+1 = 6

Note:- Using Only one variable
__________________
Regards,
VELHARI
I am not totally useless. I can be used for a bad example

Last edited by velhari : 11-17-2007 at 03:23 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-18-2007, 08:48 PM
ramkumaraol ramkumaraol is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 98
ramkumaraol is on a distinguished road
Default Re: Solve the problem, if you possible?

Hi vel,

$a = 5;
printf("%d+1 is =%d",$a-1,++$a);

Thanks,
Ramkumar.B
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-21-2007, 06:25 AM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 67
velhari is on a distinguished road
Send a message via AIM to velhari
Thumbs up Re: Solve the problem, if you possible?

Another solution is,

int d=5;
printf("additon of %d + 1 = %d",d++);
__________________
Regards,
VELHARI
I am not totally useless. I can be used for a bad example
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-24-2007, 02:15 AM
seesamjagan seesamjagan is offline
D-Web Programmer
 
Join Date: Aug 2007
Location: Chennai
Posts: 66
seesamjagan is on a distinguished road
Send a message via AIM to seesamjagan Send a message via Yahoo to seesamjagan
Default Re: Solve the problem, if you possible?

Quote:
Originally Posted by velhari View Post
Another solution is,

int d=5;
printf("additon of %d + 1 = %d",d++);

output of the above code will be

addition of 5 + 1 =

because the second parameter for the last %d is missing

so it should be like this
int d=5;
printf("additon of %d + 1 = %d",d,d+1);

to get the out as follows

adition of 5 + 1 is 6
__________________
SeeSamJagan
- Sky is not the "LIMIT", Death is not the END, There is still something beyond....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to solve this problem(The remote server returned an error: (401) Unauthorized.) GDevakii ASP and ASP.NET Programming 0 09-28-2007 10:15 PM
How to solve DVD slow read problems in Windows XP itbarota Computer Hardware 2 08-06-2007 07:51 AM
What are the different problems that “Data mining” can solve? Data warehousing oxygen Database Support 1 07-26-2007 03:37 AM
How to solve the SQDataReader not closed problem when excuting another query during i Archer C# Programming 1 07-23-2007 11:30 PM
Problem on .net 3.0 WPF! theone C# Programming 0 07-19-2007 09:56 PM


All times are GMT -7. The time now is 10:31 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0