Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

i need help ><

Name: Anonymous 2008-10-20 19:18

hey guys, im really new to programming and my homework tonight is to make a program that asks for 2 numbers then adds, subtracts, multiplies and divides them.  my subtraction formula is not working and im really frustrated ><  could you guys help?  also when i do something like... printf("%2.4f");     its not working for me and i dont know why, im using code blocks.  ill post my work below here, thanks!  (remember i suck at programming and im new, and im not done yet.... this is in C!!! not c++)

#include <stdio.h>

int main(void)
{
    float num1, num2, add, subtract, multiply, divide;

    printf("This program will ask you for two numbers.");

    printf("Please enter a number:");
    scanf("%f", &num1);

    printf("Please type in another number:");
    scanf("%f", &num2);

    add = num1 + num2;

    printf("%f", num1);
    printf(" Added to ");
    printf("%f", num2);
    printf("Equals ");
    printf("%f", add);

    num1 - num2 = subtract
   
    printf("%f", num1);
    printf(" Minus ");
    printf("%f", num2);
    printf("Equals ");
    printf("%f", subtract);

    return (0);
}

Name: Anonymous 2008-10-21 0:29

>>12
I'd lick the Ginger's irish potatoes, if you catch my drift.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List