Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: Prap

Problemset: เลขหลักของผลคูณ

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-25 13:41:02

#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;
int main() {
	int A,B,x;
	cout<<"A = ";
	cin>>A;
	cout<<"B = ";
	cin>>B;
	cout<<"x = ";
	cin>>x;
	int nig = A*B;
	int ga = nig;
	int c = 0;
	while (ga != 0) {
		ga = ga / 10;
		c++;
	}
	ga = nig;
	int count;
	int num[c] = {0};
	for (int i = 0; i<c; i++) {
		num[i] = (ga % int(pow(10,i+1))) / pow(10,i);
		ga = ga - (ga % int(pow(10,i+1)));
	}
	if (x > c) {
		cout<<"_";
		return 0;
	}
	c = c - x;
	cout<<num[c];
	return 0;
}