Here's my code
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
long long int N = 0, product, sum;
int t; scanf_s("%d", &t); //// ERROR STARTS AT THIS LINE
while (t--)
{
sum = 0;
scanf_s("%d", &N);
N = N / 2;
product = 1;
sum = 1;
for (int i = 1; i <= N; i++)
{
product = product * i;
sum += product;
}
printf("%d \n", sum);
}
return 0;
}
I get this compiling error when submitting solution to www.codechef.com
prog.cpp: In function 'int main()':
prog.cpp:9:25: error: 'scanf_s' was not declared in this scope
int t; scanf_s("%d", &t);
I have tried compiling with C++ (gcc-4.3.2)
, (C++ gcc-4.9.2)
and C++ 14 (g++4.9.2)
, didn't work.
Why..? I have included <stdio.h>
.
You can change
scanf_s
to scanf
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With