week 0 assignment,Average of two even integers

52 views
Skip to first unread message

lvash...@gmail.com

unread,
Sep 2, 2020, 9:15:51 AM9/2/20
to Discussion forum for Introduction to Programming in C, noc19-cs6...@nptel.iitm.ac.in
Dear Sir,
when writing this to get average of two numbers,
 
#include<stdio.h>
void main(){
  int a,b
  int average=0;
    scanf("%d,%d",&a,&b)
    printf("%d",average)
  return 0;
}

its showing an error i.e., 
Programtest.c: In function main: test.c:6:5: error: expected ; before printf printf("%d",average) ^~~~~~

Would you please assist.         

ani.mai...@gmail.com

unread,
Sep 3, 2020, 1:43:54 AM9/3/20
to Discussion forum for Introduction to Programming in C, noc19-cs6...@nptel.iitm.ac.in
check the below highlights:

red = not required
orange= required

#include<stdio.h>
void main(){
  int a,b;
  int average=0;
    scanf("%d,%d",&a,&b);
    printf("%d",average);
  return 0;
}

anga...@gmail.com

unread,
Sep 3, 2020, 12:51:47 PM9/3/20
to Discussion forum for Introduction to Programming in C, noc19-cs6...@nptel.iitm.ac.in


On Wednesday, September 2, 2020 at 6:45:49 PM UTC+5:30, lvash...@gmail.com wrote:

anga...@gmail.com

unread,
Sep 3, 2020, 12:53:20 PM9/3/20
to Discussion forum for Introduction to Programming in C, noc19-cs6...@nptel.iitm.ac.in


On Wednesday, September 2, 2020 at 6:45:49 PM UTC+5:30, lvash...@gmail.com wrote:
sir , try this by removing comma symbol in scan
scanf("%d%d",&a,&b); 
   
Reply all
Reply to author
Forward
0 new messages