0
Can anyone tell me what wrong in this code why i am not getting correct value of volume of cylinder ???
#include <iostream> using namespace std; void cylindervolume(){ double r , h, volume; cout << "enter the number r "<<endl; cin>>r; cout << "enter the number h"<<endl; cin>>h; volume=3.14*r*r*h; cout<<"the volume of cylinder is "<<volume<<endl; } int main(){ int a ,cubevolume; cout<<"enter the side a "<<endl; cin>>a; cubevolume = a*a*a; cout<<"the cubevolume of cube is "<<cubevolume<<endl; cylindervolume(); return 0; }
6 Respostas
+ 4
it working fine, the problem is with sololearn input. You have to input all inputs at once so need input this: 1 1 1
https://sololearn.com/compiler-playground/crXMMh2NsYtb/?ref=app
+ 2
i can't see any issue with you code, maybe you giving wrong inputs?
+ 1
I gave 1and 1 in inputs
+ 1
Ans should be 3.14 but its coming something different
+ 1
Thanks
0
Define inputs in void....( Double r,h, volume){}