My issue
im getting the required output but its showing that wrong answer
My code
#include <stdio.h>
int main(void) {
int b;
int r;
scanf("%d%d",&b,&r);
if(r>b)
{
printf("Rob Scored higher marks than Bob.\n");
}
else if(r==b)
{
printf("Bob & Rob both scored the same\n");
}
else
{
printf("Bob scored higher than Rob");
}
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone
@lokamithra
U have to do it like this
#include <stdio.h>
int main() {
int r;
int b;
r = 45;
b = 23;
if (r > b) {
printf("Rob Scored higher marks than Bob.\n");
} else if (r == b) {
printf("Bob & Rob both scored the same\n");
}
r = 15;
b = 15;
if (r > b) {
printf("Rob Scored higher marks than Bob.");
} else if (r == b) {
printf("Bob & Rob both scored the same");
}
return 0;
}
hey hii!! here they didn’t ask you read the inputs instead they gave you some values to inititalize for r and b (b=23 and r=45) and then (b=15 and r==15)
#include <stdio.h>
int main(void) {
int b,r;
b=23,r=45;
if(r>b)
printf("Rob Scored higher marks than Bob.\n");
else if(r==b)
printf("Bob & Rob both scored the same\n");
else
printf("Bob Scored higher marks than Rob\n");
b=15,r=15;
if(r>b)
printf("Rob Scored higher marks than Bob.\n");
else if(r==b)
printf("Bob & Rob both scored the same\n");
else
printf("Bob Scored higher marks than Rob\n");
return 0;
}
This should slove your problem