0
Error in the program, it shows no output when i try to run it.
#include <stdio.h> int main() { int n; scanf("%d",n); int p =5; int q = 4; int cost; if(n%2==0) { cost = (n/2)*q; } else { cost = p+((n-1)/2)*q; } printf("%d",cost); return 0; }
4 Respostas
+ 4
Should be:
scanf("%d", &n);
not
scanf("%d", n);
0
Thanks @Phurinat, basics really matter.