Skip to content

Instantly share code, notes, and snippets.

@jacobhenke
Forked from MitchellScottHenke/formula.c
Last active February 3, 2016 16:54
Show Gist options
  • Save jacobhenke/0471cf1285bbd7d7b901 to your computer and use it in GitHub Desktop.
Save jacobhenke/0471cf1285bbd7d7b901 to your computer and use it in GitHub Desktop.
//
// main.c
// help
//
// Created by Jacob Henke on 2/3/16.
// Copyright © 2016 Jacob Henke. All rights reserved.
//
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[]) {
float a, b, c;
float result;
printf("Working on a Quadratic formula? Let me help!\nA=");
scanf("%f",&a);
printf("B=");
scanf("%f",&b);
printf("C=");
scanf("%f",&c);
result =pow(b, 2) - (4*a*c);
printf("A=%f\nB=%f\nC=%f\n",a,b,c);
if ( result < 0)
printf("You have a non-real answer on your hands.\n");
else
printf("%f\n", result);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment