Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Solved Programs on C++ » C++ Program to find some of all digit of any number

C++ Program to find some of all digit of any number & Mod operations

#include<iostream>
using namespace std;

int main(){
long int no, sum;
no=sum=0;

cout<<"\n Enter 9 digit no : ";
cin>>no;

while(no!=0){
    sum += no%10;
    no = no/10;
}

int i;
for(i=8;i>1;i--)
{
    if(i== (sum-i)%10){
    cout<<"\n Account Number is not Okay.";  break;
    
    }
    else{
    cout<<"\n Account Number is Okay.";
    break;
    }
    
}
    
}

c++ program to check digit
c++ program to check digit