-2

c program

my c program for factorial is not giving any value in the output box though it shows no errors

 #include<stdio.h>
    main()
    {
        int a,n,t=1;
        printf("enter the number\n");
        scanf("%d",a);
        for(n=1;n<=a;n++)
        {
            t*=n;
        }
        printf("the factorial is %d",t);
    }

the image

Matt Rowland
  • 4,575
  • 4
  • 25
  • 34
Kushal
  • 1

1 Answers1

0

You'll have to pass address of variable a like this.. scanf("%d", &a);

Andrea Oggioni
  • 128
  • 1
  • 9