I hope you guys can help me with this calculator program that i wrote
this programming stuff is still new to me and i cant figure out why it wont the way i want it too forgive me if its something stupid. its supposed to take in to continually give an answer to the problem but it gets stuck on the first answer any help is appreciated.
Code:
#include <stdio.h >
#include <stdlib.h>
int main(){
int l=0, l1=0;
float f1, f2,f3;
char op, op1;
printf("please enter a problem:\n\n");
while(l==0){
//inputs
if( l1 == 0 )scanf("%f",&f1);
scanf("%c",&op);
if(op != '=')scanf("%f",&f2);
// calculatons
if(op == '+' ){f1 = f1+f2;}
if(op == '-' ){f1 = f1-f2;}
if(op == '*' ){f1 = f1*f2;}
if(op == '/' ){f1 = f1/f2;}
if(op == '=' ){ l=1;}
// output
l1 = 1;
printf("%f",f1);}
printf("final answer:%f",f3);
system("pause");
return(0);}