You prograsm is full of bugs. You have to be careful while writing a
C
program:
C
is case-sensitive, if you name a variable Mark1
then every its occurrence must be written exactly Mark1
('mark1' is not an option). Likewise there is a printf
function, not a 'Printf'.scanf
takes the address of the arguments whereas printf
takes the value of the arguments.- The statement are terminated by semicolon (
;
) not colon (':'). - The format specifier of strings is
%s
not '%c'. - You missed the trailing double quote of the format specifier in the last two
printf
calls
For sure I missed to report something...
Please note you are computing the
average value of the two marks, not a
percent at all.
Try
#include <stdio.h>
int main ()
{
char name[50];
int roll, mark1, mark2;
int sum;
double avg;
printf("enter the name and roll number\n");
scanf("%s %d" , name, &roll);
printf("enter the marks of two subject\n");
scanf("%d %d" , &mark1, &mark2);
sum = mark1 + mark2;
avg = (mark1 + mark2)/2.0;
printf("the name is %s and roll mo is %d\n", name, roll );
printf("total marks are %d and the average is %g\n", sum, avg);
getchar();
return 0;
}