#include <stdio.h>
main()
{
int h1, m1, s1, h2, m2, s2, h3, m3, s3, oper, A, S;
printf("Please enter first clock:\n");
scanf("%d:%d:%d", &h1, &m1, &s1);
printf("Please enter second clock:\n");
scanf("%d:%d:%d", &h2, &m2, &s2);
printf("Enter A for addition or S for subtraction:\n");
scanf("%d", &oper);
{
if(oper=='S')
{
s3=(s1-s2);
m3=(m1-m2);
h3=(h1-h2);
if(s3<0)
{
s3=s3+60;
m3=m3;
h3=h3+24;
}
}
else
if(oper=='A');
{
s3=(s1+s2)%60;
m3=(m1+m2+((s1+s2)/60))%60;
h3=(h1+h2+((m1+m2)/60))%24;
}
}
printf("%2.2d:%2.2d:%2.2d\n", h3, m3, s3);
return 0;
}
the program only adds when i try to subtract instead of subtracting it adds them take a look n see if my if statement is wrong