lenght of Given String


code:

#include<iostream>
#include<conio.h>
#include<stdio.h>

using namespace std;

void main()
{
       char str[100];
       int lenth=0;
       cout<<"enter string : ";
       cin.get(str,100);
       for(int i=0;str[i]!='\0';i++)

       {
              lenth++;
       }
       cout<<"the length of string  :"<<lenth;
     
  getch();
}


output:



No comments:

Post a Comment