Advertisement
rahat62

int & string length

Feb 28th, 2024
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.20 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.    int n;
  5.    cin>>n;
  6.    int len = log10(n) + 1;
  7.    cout<<len<<endl;
  8.  
  9.    string s;
  10.    cin>>s;
  11.    int l =s.length();
  12.    cout<<l<<endl;
  13.  
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement