Take input from user and count the number of digit from an integer number. For example if you take 2017, the output will be 4.
Put your answer in comment section. You may use dropbox link here.
Put your answer in comment section. You may use dropbox link here.
//Count Digit from an Integer Number
ReplyDelete#include
using namespace std;
int main()
{
int no,a=0;
cout<<"Enter any num : ";
cin>>no;
while(no>0)
{
no=no/10;
a++;
}
cout<<"\n No. of digits in given number is : "<<a;
}
//count digit form an integer number
ReplyDelete#include
using namespace std;
int main()
{
int Number,a=0;
cout<<"Enter any num : ";
cin>>Number;
if(Number<0)
{
Number=Number * -1;
}
else if(Number==0)
{
Number=1;
}
while(Number>0)
{
Number=Number/10;
a++;
}
cout<<"\n Number of Digit = "<<a;
}
ReplyDelete#include
using namespace std;
int main()
{
int num,i=0;
cout<<"Give me the number, i shall count : ";
cin>>num;
while(num>0)
{
num=num/10;
i++;
}
cout<<"\n Well , Dear, This integer number contains this much digits: : "<<i;
}
#include
ReplyDeleteusing namespace std;
int main()
{
int n, i;
cout << "Enter a number: ";
cin >> n;
if(n>=10){
for( i=0; n>0; i++){
n=n/10;
}
cout << "Digits are " << i << endl;
}else{
cout << "Sorry i am not calculate over than 10 Digit Please try agin";
}
return 0;
}
//C++ Program to Count Number of Digits in a Number defined by user
ReplyDelete#include
using namespace std;
int main()
{
int number, count;
cout<<"Please Enter any number"<>number;
for (count=0; number > 0;number=number/10)
{
count=count + 1;
}
cout<<"Total Number of Digit = "<<count;
}
#include
ReplyDeleteusing namespace std;
int main()
{
int n, count=0;
cout << "Enter a number: ";
cin >> n;
do{
n=n/10;
count++;
}
while(n>0);
cout << "Digits are " << count << endl;
return 0;
}
#include
ReplyDeleteusing namespace std;
int main()
{
int number,digit_count,original_number;
digit_count=0;
cout<<
"Enter your number here:";
cin>>number;
original_number=number;
while(number>0)
{
digit_count=digit_count+1;
number/=10;
}
cout<<
"Total digit of this number "<<original_number <<" is: "<<digit_count;
return 0;
}
#include
ReplyDeleteusing namespace std;
int main ()
{
int a, count=0;
cout << "Enter a number:";
cin>> a;
do {
a=a/10;
cout++;
while (a>0);
cout <<" Digit are "<<cout <<endle
return 0;
}
ReplyDelete#include
using namespace std;
int main()
{
int num,a=0;
cout<<"Enter any number";
cin>>num;
while(num>0)
{
num=num/10;
a++;
}
cout<<"\n The given number is : "<<a;
}
#include
ReplyDeleteusing namespace std;
int main()
{
int value,a=0;
//clrscr();
cout<<"Enter a number what your chose = ";
cin>>value ;
cout<<"Thanks you for chose a value ";
while(value>0)
{
value=value/10;
a++;
}
cout<<"\nThe result is = "<<a;
//getch();
}
#include
ReplyDeleteusing namespace std;
Int main () {
Int Number,i= 0;
cout<<"Enter your number : ";
cin>>Number;
while (Number !=0){
Number = Number/10;
i++;
}
cout<<"The Number : "<<i;
}
//Count Digit from an Integer Number
ReplyDelete#include
using namespace std;
int main()
{
int i=0;
double x;
cout << "Enter a number: ";
cin >> x;
while(x > 1)
{
i++;
x = x/10;
}
cout<<"\n Total digits: "<<i;
}
#include
ReplyDeleteusing namespace std;
int main()
{
int num,i=0;
cout<<"Give me the number, i shall count : ";
cin>>num;
while(num>0)
{
num=num/10;
i++;
}
cout<<"\n Well , Dear, This integer number contains this much digits: : "<<i;
}
#include
ReplyDeleteusing namespace std;
int main()
{
int num,a=0;
cout<<"Enter any num : ";
cin>>num;
for(a=0;num>0;)
{
num=num/10;
a++;
}
cout<<"\n No. of digits in given number is : "<<a;
}
/*******************************
ReplyDeleteForhad Parvez
CSE - 55th Batch
C++ - 2018
********************************/
#include
using namespace std;
class input{
public:
int num;
void getdata(){
cin>>num;
}
};
class calc : public input {
public:
int newval(){
int count=0;
while(num>0){
num=num/10;
count++;
}
return count;
}
};
int main()
{
calc obj;
cout<<"Please Enter A Number : ";
obj.getdata();
cout<<"Total Number : "<<obj.newval();
return 0;
}
sayeka jannat
ReplyDeleteID:201720097
Batch:55th
I could not use Dropbox Gave directly
#include
using namespace std;
int main()
{
int i=0, number;
cout<<"Enter a number: \n";
cin>> number;
while (number>0)
{
number=number/10;
i++;
}
cout<<"Number of digits: "<<i;
return 0;
}
/*Taslima Akter
ReplyDeleteID-201720079
Batch-55
program-count digit of an integer number.
*/
#include
using namespace std;
class digit
{
public:
void getinput(int a)
{
num=a;
}
protected:
int num;
};
class temp:public digit
{
public:
int data()
{
int n=0;
while(num>0)
{
num=num/10;
n++;
}
return n;
}
};
int main()
{
temp obj;
int y;
cout<<"enter the number:";
cin>>y;
obj.getinput(y);
cout<<obj.data();
return 0;
}
//Taslima Akter
ReplyDeleteID-201720079
Batch-55//
program-count digit of an integer number.
#include
using namespace std;
class digit
{
public:
void getinput(int a)
{
num=a;
}
protected:
int num;
};
class temp:public digit
{
public:
int data()
{
int n=0;
while(num>0)
{
num=num/10;
n++;
}
return n;
}
};
int main()
{
temp obj;
int y;
cout<<"enter the number:";
cin>>y;
obj.getinput(y);
cout<<obj.data();
return 0;
}
//Taslima Akter
ReplyDeleteID-201720079
Batch-55//
program-count digit of an integer number.
#include
using namespace std;
class digit
{
public:
void getinput(int a)
{
num=a;
}
protected:
int num;
};
class temp:public digit
{
public:
int data()
{
int n=0;
while(num>0)
{
num=num/10;
n++;
}
return n;
}
};
int main()
{
temp obj;
int y;
cout<<"enter the number:";
cin>>y;
obj.getinput(y);
cout<<obj.data();
return 0;
}
Sorry sir, 1st er ta ami single inheritance chara koresilam. ekhon notun kore single inheritance diye submit korlam.
ReplyDelete---------------------------------
Name: Md. Johorul islam
ID: 201720237
Batch: 55 Diploma, Section : B
----------------------------------------------
#include
using namespace std;
class jewel{
public:
int i=0, start;
int myway()
{
cout<<"Please enter a number: \n";
cin>> start;
while (start>0)
{
start=start/10;
i++;
}
return i;
}
};
class sohel: public jewel{
public:
int getway()
{
}
};
int main()
{
sohel object;
cout<<"The Number of digits is : "<<object.myway();
}
Name: Md. Johorul islam
ReplyDeleteID: 201720237
Batch: 55 Diploma, Section : B
----------------------------------------------
#include
using namespace std;
class jewel{
public:
int i=0, start;
int myway()
{
cout<<"Please enter a number: \n";
cin>> start;
while (start>0)
{
start=start/10;
i++;
}
return i;
}
};
class sohel: public jewel{
public:
int getway()
{
}
};
int main()
{
sohel object;
cout<<"The Number of digits is : "<<object.myway();
}
Sany Ahmed
ReplyDelete201720287
55th Batch
#include
using namespace std;
class mahi{
public:
int k;
void getin(){
cin>>k;
}
};
class plc : public mahi {
public:
int newin(){
int count=0;
while(k>0){
k=k/10;
count++;
}
return count;
}
};
int main()
{
plc obj;
cout<<"Please Enter A Number : ";
obj.getin();
cout<<"Total Number : "<<obj.newin();
return 0;
}
//Taslima Akter
ReplyDeleteID-201720079
Batch-55//
program-count digit of an integer number.
#include
using namespace std;
class digit
{
public:
void getinput(int a)
{
num=a;
}
protected:
int num;
};
class temp:public digit
{
public:
int data()
{
int n=0;
while(num>0)
{
num=num/10;
n++;
}
return n;
}
};
int main()
{
temp obj;
int y;
cout<<"enter the number:";
cin>>y;
obj.getinput(y);
cout<<obj.data();
return 0;
}
//Taslima Akter
ReplyDeleteID-201720079
Batch-55//
program-count digit of an integer number.
#include
using namespace std;
class digit
{
public:
void getinput(int a)
{
num=a;
}
protected:
int num;
};
class temp:public digit
{
public:
int data()
{
int n=0;
while(num>0)
{
num=num/10;
n++;
}
return n;
}
};
int main()
{
temp obj;
int y;
cout<<"enter the number:";
cin>>y;
obj.getinput(y);
cout<<obj.data();
return 0;
}
-----------------------
ReplyDeleteFazle Rabbi Khan Taron
ID : 201720263
Batch: 55th
-----------------------
#include
using namespace std;
class count
{
public:
void num(int a)
{
b=a;
}
protected:
int b;
};
class prob:public count
{
public:
int temp()
{
int z=0;
while(b>0)
{
b=b/10;
z++;
}
return z;
}
};
int main()
{
prob obj;
int x;
cout<<"enter the number:";
cin>>x;
obj.num(x);
cout<<obj.temp();
return 0;
}
/******************
ReplyDelete* Khorshed Alam *
* CSE-56th *
* ID: 201730438 *
******************/
#include <iostream>
using namespace std;
class counter
{
public:
int a = 0;
int number(int x)
{
while(x>0)
{
x = x/10;
a++;
}
return a;
}
};
class math:public counter
{
public:
int x;
int getval()
{
cout<<"Input a number to calculate digit ";
cin>>x;
return x;
}
};
int main()
{
math m;
int x = m.getval();
cout<<"This number contains = "<<m.number(x)<<" digits";
}
Yousuf Ahmmed
ReplyDeleteBatch: 56th
Roll: 201730047
#include
using namespace std;
class counter
{
public:
int a = 0;
int number(int z)
{
while(z>0)
{
z = z/10;
d++;
}
return d;
}
};
class math:public counter
{
public:
int z;
int getval()
{
cout<<"Input a number to calculate digit ";
cin>>z;
return z;
}
};
int main()
{
math m;
int z = m.getval();
cout<<"This number contains = "<<m.number(z)<<" digits";
}
/*Ariful Islam
ReplyDeleteID: 201730750
AUB CSE 56th Batch*/
#include
using namespace std;
class counter
{
public:
int n = 0;
int number(int i)
{
while(i>0)
{
i = i/10;
n++;
}
return n;
}
};
class math:public counter
{
public:
int i;
int getval()
{
cout<<"Input a number to calculate digit ";
cin>>i;
return i;
}
};
int main()
{
math m;
int i = m.getval();
cout<<"This number contains = "<<m.number(i)<<" digits";
}
/*Ariful Islam
ReplyDeleteID: 201730750
AUB CSE 56th Batch*/
#include
using namespace std;
class counter
{
public:
int n = 0;
int number(int i)
{
while(i>0)
{
i = i/10;
n++;
}
return n;
}
};
class math:public counter
{
public:
int i;
int getval()
{
cout<<"Input a number to calculate digit ";
cin>>i;
return i;
}
};
int main()
{
math m;
int i = m.getval();
cout<<"This number contains = "<<m.number(i)<<" digits";
}
#include
ReplyDeleteusing namespace std;
class digit{
public:
int a;
int getnum(){
cout<<"Enter your Digits :";
cin>>a;
}
};
class count: public digit{
public:
int b=0;
int check(){
while(a>0){
a=a/10;
b++;
}
return b;
}
};
int main()
{
int result;
count obj;
obj. getnum();
cout<<"Total Digit :"<<obj.check();
}
Al Hasan
ReplyDeleteID:201730011
CSE: 56th
--------------
#include
using namespace std;
class counter
{
public:
int a = 0;
int number(int x)
{
while(x>0)
{
x = x/10;
a++;
}
return a;
}
};
class math:public counter
{
public:
int x;
int getval()
{
cout<<"Input a number to calculate digit ";
cin>>x;
return x;
}
};
int main()
{
math m;
int x = m.getval();
cout<<"This number contains = "<<m.number(x)<<" digits";
}