Finding the total measurements in fleet from a list of 5 numbers
#include<iostream>
using namespace std;
int findTotalFeet(int n, int arr[])
{
int feet=0;
for(int i=0;i<n;i++)
{
feet+=arr[i]/12;
}
return feet;
}
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
cout<<findTotalFeet(n,arr);
return 0;
}
Comments
Leave a comment