#include <stdio.h>main(){ int a, b, c, result, bwpow, desition; printf("Welcome to the iDeveloper's (manudo) discriminant calculator! "); getchar(); printf("Do you know the a, b, and c of the ecuation? [Y=1/N=0] "); scanf("%d", &desition); if (desition == 1) printf("Then enter the a "); scanf("%d", &a); printf("Enter the b "); scanf("%d", &b); printf("Enter the c "); scanf("%d", &c); bwpow = b * b; result = bwpow - 4*a*c; printf("The discriminant of the ecuation is: %d", result); else printf("Nothing to calculate, press enter and Alt+F4 to leave "); return 0;}
if (desition == 1) printf("Then enter the a "); // Aca termina el if
printf("The discriminant of the ecuation is: %d", result); // Aca es donde en realidad deberia terminar el if else printf("Nothing to calculate, press enter and Alt+F4 to leave ");
int main(){ int a, b, c, result, bwpow, desition; printf("Welcome to the iDeveloper's (manudo) discriminant calculator! "); getchar(); printf("Do you know the a, b, and c of the ecuation? [Y=1/N=0] "); scanf("%d", &desition); if (desition == 1) { // Se utilizan llaves {} para indicar un bloque de sentencias dentro de un if printf("Then enter the a "); scanf("%d", &a); printf("Enter the b "); scanf("%d", &b); printf("Enter the c "); scanf("%d", &c); bwpow = b * b; result = bwpow - 4*a*c; printf("The discriminant of the ecuation is: %d", result); } // Cerramos la llave para indicar que es el fin del bloque else printf("Nothing to calculate, press enter and Alt+F4 to leave "); return 0;}