HELP WITH REPEATED ADDITION

Write a program to compute the volume of a cylinder
by repeated addition NOTE: you are not allowed to use
multiplication, division or any predefined functions

calculations:
volume = pie radius^2(squared) * height
pie = 3.1416

user input :
radius
height

i have no idea as to how to execute this program with out
using * operator if anyone can help i will be very greatful
we are using the
#include<iostream> //this is the header we are using
using namespace std


This code calculates "c = a * b":
1
2
3
c = 0;
for (int i = 0; i < a; i++)
  c += b;
Thanks alot
#include <iostream>
using namespace std;
void main()
{
double h, r,x,y,z,volume;
const double pie = 3.1416;

cout<<"enter the height and enter the radious:" ;
cin>>h>>r;
x=0;
for (int i=0; i<r; i++)

x+=r;// good

y=0 ;
for (int j=0 ; j<x;j++)

y+= h;

z=0;
for (int k=0; k<y ; k++)

z+=pie;

volume = z;
cout<<"This is the volume:"<<volume<<endl;


}
Topic archived. No new replies allowed.