ccompilationcompiler-errorsruntime-compilation

How to resolve "expected ';' before '{' token" in C?


I created a program to print the roman equivalent of a year, but my program shows a compilation error. My program says:

33 4 C:\Users\ABC\Desktop\c.c [Error] expected ';' before '{' token

Here is my code:

#include<stdio.h>
main()
{
    int a,rom;
    printf("Enter the year.");
    scanf("%d",&a);
    rom=reverse(a);
    printf("Roman equivalent of %d is:",a);
}
reverse(int a)
{
    int i,rev=0,rem;
    for(i=a;i>0;i=i/10)
    {
        rem=i%10;
        rev=rev*10+rem;
    }
    roman(a);
}
roman(int a)
{
    int c=0,i,j,k,l,m;
    for(i=a;i>0;i=i/10)
    {
        m=i%10;
        for(j=1;j>0;j--)
        {
            if(c==0)
            {
                printf("m\n");
            }
            elseif(c==1)
            {
                printf("d\n");
                for(l=m-5;l>0;l--)
                    printf("c");
                printf("\n");
            }
            elseif(c==2)
            {
                printf("l\n");
                for(l=m-5;l>0;l--)
                {
                    printf("x");
                }
                printf("\n");
            }
            elseif(c==3)
            {
                printf("v\n");
                for(l=m-5;l>0;l--)
                {
                    printf("i");
                }
                printf("\n");
            }
        }
        c++;
    }
}

Solution

  • use else if instead of elseif.