Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
November 1st, 2012, 07:18 AM
 princemoon
Registered User

Join Date: Nov 2012
Posts: 3
Time spent in forums: 1 h 34 m 46 sec
Reputation Power: 0
I am a beginner, help required.... plz

Write down C statements to perform the following operations. Take x, y and z from the user:
z = 4.2(x+y)5/z – 0.52x/(y+z) / (x+y)

Code:
```#include <iostream.h>
main()
{
z = 4.2(x+y)5/z – 0.52x/(y+z) / (x+y)
}```

How to implement the code for this?

#2
November 1st, 2012, 08:05 AM
 bdb
Contributing User

Join Date: Aug 2012
Posts: 156
Time spent in forums: 1 Week 15 h 48 m 11 sec
Reputation Power: 33

#3
November 1st, 2012, 10:10 AM
 princemoon
Registered User

Join Date: Nov 2012
Posts: 3
Time spent in forums: 1 h 34 m 46 sec
Reputation Power: 0
#include <iostream.h>
main()
{
int x,y,z;
cin>>x>>y;
z = 4.2*x+y*5/z – 0.52*x/y+z/x+y
cout<<z;
}

It's showing error on line 7 "statement missing"

#4
November 1st, 2012, 10:14 AM
 ptr2void
I haz teh codez!

Join Date: Dec 2003
Posts: 2,530
Time spent in forums: 1 Month 2 Weeks 3 Days 18 h 49 m 46 sec
Reputation Power: 2336
And how do you end a statement in C++? You're doing it properly everywhere else...
__________________
I ♥ ManiacDan & requinix

This is a sig, and not necessarily a comment on the OP:
Please don't be a help vampire!

#5
November 1st, 2012, 10:15 AM
 bdb
Contributing User

Join Date: Aug 2012
Posts: 156
Time spent in forums: 1 Week 15 h 48 m 11 sec
Reputation Power: 33
Also z is not initialized or assigned a value before being used.

#6
November 1st, 2012, 10:29 AM
 princemoon
Registered User

Join Date: Nov 2012
Posts: 3
Time spent in forums: 1 h 34 m 46 sec
Reputation Power: 0
Look at this

#include <iostream.h>
main()
{
int x,y,z;
cin>>x>>y;
z=4.2*x+y*5/z-0.52*x/y+z/x+z
cout<<z;
return 0;
}
Still statement missing, will you help what to do?
ptr2void disagrees: Pay attention to what people are telling you.

#7
November 1st, 2012, 10:46 AM
 bdb
Contributing User

Join Date: Aug 2012
Posts: 156
Time spent in forums: 1 Week 15 h 48 m 11 sec
Reputation Power: 33
pay attention to semicolons

#8
November 1st, 2012, 03:06 PM
 dwise1_aol
Contributing User

Join Date: Jan 2003
Location: USA
Posts: 6,863
Time spent in forums: 3 Months 1 Day 7 h 6 m 45 sec
Reputation Power: 2199
As they keep telling you, pay attention to semicolons and to how you end statements in C++.

Also, from your problem statement, pay attention to grouping symbols, which is what parentheses are. Grouping symbols appear in your problem statement, but not in your attempts to code it.

Take x, y and z from the user:
Why then do you only ask for x and y?

 Viewing: Dev Shed Forums > Programming Languages > C Programming > I am a beginner, help required.... plz