Sofdor Ali's Magical Blackboard!

Sofdor Ali found interest in mathematics very early in his life. And now, he wants to spread this in…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

#include <stdio.h>

int main() {
int a,b,c,d=0,i;
scanf(“%d”,&a);
scanf(“%d %d”,&b,&c);
for(i=1;i<=c;i++){
d=d+b;
}
printf(“%d”,d);
return 0;
}

probelm???

First of all, Input will not contain only 3 integers it will contain. It will contain T number of input.
To solve this problem you will first need to get the value of T then you can use while loop to get T number of input.
A sample code.

int t;
scanf("%d", &t);
while(t--){
  //here you need to use scanf  to take value of A and B
  //then calculate the value and print it using printf
}

then what is the problem with my code?

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
unsigned int a[t][2],r[t];
for(int i=0;i<t;i++)
{
cin>>a[i][0]>>a[i][1];
r[i]=0;
for(int j=0;j<a[i][1];j++)
{
r[i]=r[i]+a[i][0];
}
}
for(int i=0;i<t;i++)
cout<<r[i]<<endl;
}