// This program is calling a function to calculate the length of any number.
#include <iostream>
using namespace std;
//Function declaration
int countN ( int );
main( )
{
int num;
cout << "\n No. of digits in given number is: " << countN(num);
}
// function to calculate the power of some number
int countN ( int i )
{
int a, num;
cout<<"Enter any num : ";
cin>>num;
while(num>0)
{
num=num/10;
a++;
}
return a;
}
#include <iostream>
using namespace std;
//Function declaration
int countN ( int );
main( )
{
int num;
cout << "\n No. of digits in given number is: " << countN(num);
}
// function to calculate the power of some number
int countN ( int i )
{
int a, num;
cout<<"Enter any num : ";
cin>>num;
while(num>0)
{
num=num/10;
a++;
}
return a;
}
No comments:
Post a Comment