关于一元二次方程求解的c语言问题

问题遇到的现象和发生背景

新学c语言,解决二元一次方程的两个解
不熟悉vc++的使用

问题相关代码,请勿粘贴截图
# include 
# include 
int main(void)
{
    int a=1;
    int b=2;
    int c=1;
    double delta;
    double x1,x2;
    delta=b*b-4*a*c;
    if (delta==0)
    {
        x1=(-b)/(2*a);
        x2=x1;
        printf("1");
    }
    else if (delta>0)
    {
        x1=(-b+sqrt(delta))/(2*a);
        x2=(-b-sqrt(delta))/(2*a);
        printf("2");
    else
    {
        printf("无解\n");
    }
    return 0;
}

运行结果及报错内容

显示如下

--------------------Configuration: practice - Win32 Debug--------------------
Compiling...
practice.c
C:\Users\Jiayuan Xu\Desktop\c\practice.c(22) : error C2181: illegal else without matching if
C:\Users\Jiayuan Xu\Desktop\c\practice.c(28) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

practice.exe - 1 error(s), 0 warning(s)

我想要达到的结果

1,帮忙看一下上述代码哪里有错
2,运行时总是弹出“一个或多个文件已过时或不存在”一类的窗口,保存了也没用,希望能解决这个问题

代码有错误,大括号缺失。


# include <stdio.h>
# include <math.h>
int main(void)
{
    int a=1;
    int b=2;
    int c=1;
    double delta;
    double x1,x2;
    delta=b*b-4*a*c;
    if (delta==0)
    {
        x1=(-b)/(2*a);
        x2=x1;
        printf("1");
    }
    else if (delta>0)
    {
        x1=(-b+sqrt(delta))/(2*a);
        x2=(-b-sqrt(delta))/(2*a);
        printf("2");
    }else
    {
        printf("无解\n");
    }
    return 0;
}