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; }

26th May 2024, 11:17 AM
Shashank
Shashank - avatar
6 Antworten
+ 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
26th May 2024, 11:54 AM
john ds
john ds - avatar
+ 2
i can't see any issue with you code, maybe you giving wrong inputs?
26th May 2024, 11:29 AM
john ds
john ds - avatar
+ 1
I gave 1and 1 in inputs
26th May 2024, 11:42 AM
Shashank
Shashank - avatar
+ 1
Ans should be 3.14 but its coming something different
26th May 2024, 11:43 AM
Shashank
Shashank - avatar
+ 1
Thanks
26th May 2024, 5:05 PM
Shashank
Shashank - avatar
0
Define inputs in void....( Double r,h, volume){}
27th May 2024, 1:30 PM
Black Knight
Black Knight - avatar