0
Get any value and ask the user if this value is in dollars or in real. If they are dollars, convert them to real ones. If they are real, convert them to dollars. Repeat operation until the sum of the reported values is greater than 10,000.00.
#include <stdio.h>
#include <conio.h>
int main(){
float x,dr, xf, xs=0;//numero inserido, dolar ou real, numero convertido, conversao somada
while(xs<=10000){
printf("Digite o valor");
scanf("%f",x);
printf("Digite 1 para converter para dolar, e 2 para converter para real");
scanf("%f",dr);
if (dr=1) {
xf=x*3.58;
prinft("O valor em dolar e %.2f",x);
}
if (dr=2){
xf=x/3.58;
printf("O valor em reais e %.2f",x);
}
xs=xs+xf;
}
getch();
return 0;
}
In function
scanf()
the second parameter and the memory address of your variable, you must enter the address using the&
, see:scanf("%f", &dr);
.– gato
Man, I changed that but still gives the msm error :/
– Lucas Debiagi
I answered your question.
– gato