The code I wrote:
#include<stdio.h>
int main()
{
int i,m,maths=0,english=0,e,science=0,s,all=0;
for(i=1;i<=5;i++)
{
printf("enter the marks of english:\n");
scanf("%d",&e);
printf("enter the marks of maths:\n");
scanf("%d",&m);
printf("enter the marks of science:\n");
scanf("%d",&s);
if(m>=95 && s>=95 && e>=95)
all++;
if(m>=90)
maths++;
if(e>=90)
english++;
if(s>=90)
science++;
}
printf("95% or above in all subject : %d \n",all);
printf("90% or above in maths :%d\n",maths);
printf("90% or above in english: %d\n",english);
printf("90% or above in science: %d\n",science);
}
I have to input the marks of 5 students through keyboard and I am getting the following error that I don't understand. Why am I getting this kind of error?
gcc studentMarks.c -o studentMarks.out
studentMarks.c: In function ‘main’:
studentMarks.c:24:17: warning: ' ' flag used with ‘%o’ gnu_printf format [-Wformat=]
printf("95% or above in all subject : %d \n",all);
^
studentMarks.c:24:44: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
printf("95% or above in all subject : %d \n",all);
~^
studentMarks.c:25:17: warning: ' ' flag used with ‘%o’ gnu_printf format [-Wformat=]
printf("90% or above in maths :%d\n",maths);
^
studentMarks.c:25:37: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
printf("90% or above in maths :%d\n",maths);
~^
studentMarks.c:26:17: warning: ' ' flag used with ‘%o’ gnu_printf format [-Wformat=]
printf("90% or above in english: %d\n",english);
^
studentMarks.c:26:39: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
printf("90% or above in english: %d\n",english);
~^
studentMarks.c:27:17: warning: ' ' flag used with ‘%o’ gnu_printf format [-Wformat=]
printf("90% or above in science: %d\n",science);
^
studentMarks.c:27:39: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
printf("90% or above in science: %d\n",science);
~^
