Hello,
Just wanted to share with you guys how I completed my first challenge. I don’t know if this is completely correct but I hope it’s along the lines. I’m used to C++ so I started using int’s to store my variables in but that’s not what the challenge was asking so I changed things up a bit to fit the challenge. Anyways, here’s my code, and I don’t use the modern C technique ( float = ) I just use what the book taught me so far.
#include <stdio.h>
int main(int argc, const char * argv[])
{
float chal1;
chal1 = 15.6;
float chal2;
chal2 = 23.2;
double add;
add = 13.2;
printf("The two floats equals %f", chal1 + chal2);
double sum;
sum = chal1 + chal2;
printf("Together with the double they equal %f", add + sum);
return 0;
}
I could probably have used something else for the sum instead of the double but I couldn’t think of anything else to use that could store the values together, assuming I can’t use int.