+ 3

How do i input number?

I tried to run the programme but output always 0 how do i input number here is the programme #include <iostream> using namespace std; int main() { float r, area; printf("enter the value of r"); scanf("%f",&r); area = 3.1416*r*r; printf("%.2f",area); }

15th Apr 2019, 4:19 AM
nabibun billah
nabibun billah - avatar
3 odpowiedzi
+ 4
cout << "enter the value of r"; cin >> r;
15th Apr 2019, 4:41 AM
Anna
Anna - avatar
+ 2
Include stdio.h library to the programme instead of iostream . Printf and scanf functions are available in stdio library not in iostream. For inputs and outputs there is cin and cout as above answers said.
15th Apr 2019, 4:56 AM
Prashant Kumar
Prashant Kumar - avatar