You can infinitely enter numbers, but does not count anything and does not display on the screen.

#include "stdafx.h" #include <stdio.h> #include <conio.h> #include <math.h> int _tmain() { Float a, b, c, d, m, n, f; printf("na="); scanf("%f", &a); printf("nb="); scanf("%f", &b); printf("nc="); scanf("%f", &c); printf("nd="); scanf("%f", &d); m = a * d; n = b * c; f = m + n; f = sqrt(f); printf("nm=%f", m); printf("nn=%f", n); printf("nn=%f", f); printf("nn=%f", sin(f)); printf("nn=%f", cos(f)); _getch(); } 
  • Just compiled, removing #include "stdafx.h" , #include <math.h> , _getch(); and replacing _tmain() with main() . Everything is working. - VioLet
  • m ... thank you I’ll try it ... - Victor Khorolsky
  • no .. it doesn’t work anyway .. apparently the C ++ itself needs to be changed .. - Victor Khorolsky
  • You have exactly the value of f , transmitted in sqrt , is not negative? And - add at output after %f - \n : of type printf("nn=%f\n", f); - some people like to cache output ... - Harry

1 answer 1

Simplify to one variable:

 #include <stdio.h> #include <math.h> int main() { float f; printf("f=?\n"); scanf("%f", &f); f = sqrt(f); printf("sqrt(f)=%f", f); return 0; } 

Everything is working. Proof .