You are given a task to tell whether the number is pure or not. A pure number is a number whose sum of digits is multiple of 3.
You are given a task to tell whether the number is pure or not. A pure number is a number whose sum of digits is multiple of 3.
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = (data[0]);
var b = a.split('');
var sum=0;
for(i=0;i<b.length;i++)
{sum=sum+ +b[i]}
if(sum%3==0)
console.log("yes")
else
console.log("not")
});
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = (data[0]);
var b = a.split('');
var sum=0;
for(i=0;i<b.length;i++)
{sum=sum+ +b[i]}
if(sum%3==0)
console.log("yes")
else
console.log("not")
});
Comments
Post a Comment