i have written a program for average of two numbers but it's not working?

0 votes
asked Sep 24, 2018 by Hamza ishaq (120 points)

2 Answers

0 votes
answered Sep 24, 2018 by Bubba Whale (250 points)
Copy and paste the "Share" link.
0 votes
answered Sep 28, 2018 by LeoSar
#include <iostream>

template<class T, class V>
double average2Nums (T a, V b){
    return double((a + b)/2);
}

int main()
{   
    double ans = average2Nums<int, int>(1,2);
    std::cout << ans;
    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...