answersLogoWhite

0

void main()

{

char str1[30];

char str2[30];

int len1,len2;

printf("Enter string1......:");

gets(str1);

printf("Enter string2......:");

gets(str2);

len1=strlen(str1);

len2=strlen(str2);

printf("%s length = %d",str1,len1);

printf("%s length = %d",str2,len2);

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering

Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


Write a program to count the length of a string without using built in functions?

In JavaScript: To find the length of the string we you length method. __ __ __ Click the button to return the number of characters in the string "Hello World!". click here __ __ function myFunction() { var str = "Hello World!"; var n = str.length; document.getElementById("demo").innerHTML = n; } __ __ __ Hope this helps. Thank you


Write a program to encrypt a string and decrypt it using your own method of encryption and decryption.?

We'll use a simple method of encryption: xor encryption // same function used to both encrypt and decrypt void crypt(char *str) { const int key = 0x86; // crypt each individual character of str int i; const int length = strlen(str); for(i = 0; i < strlen(str); ++i) { str[i] = str[i] ^ key; } }


Write a C program to find the abbreviation of a full name without using string library function?

//C++ program to abbreviate first and middle name#include#include void main(void) { char name[40]; char abname[30]; int i,len,m=1,j=0; //puts is used to print string of characters //although cout is equivalent to it but gets //and cout should not be mixed in one program puts("Enter Name: "); //gets is used to take string input with spaces gets(name); //strlen is a built-in function, declared in //the string.h header file //it returns the length of a string len=strlen(name); abname[j++]=name[0]; abname[j++]='.'; abname[j++]=' '; for (i=0;i


Write a program that give all the rotations of a string?

#include<stdio.h> #include<string.h> int main() { char a[80]; int rotated_element_number[80]; int rotation; int i; int length; printf("enter the word: \n"); gets(a); length = strlen(a); printf("the reversed string is:\n"); for( rotation=0; rotation<length; rotation++) { for( i=0; i<length; i++) { rotated_element_number[i] = i + rotation; while(rotated_element_number[i] > (length-1)) rotated_element_number[i] -= length; printf("%c", a[rotated_element_number[i]]); } printf("\t"); } getchar(); return 0; }

Related Questions

Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


How do you write a algebraic expression for twice as long as the length of the string?

You can write 2X, where X is the length of the string.


Write a program to count the length of a string without using built in functions?

In JavaScript: To find the length of the string we you length method. __ __ __ Click the button to return the number of characters in the string "Hello World!". click here __ __ function myFunction() { var str = "Hello World!"; var n = str.length; document.getElementById("demo").innerHTML = n; } __ __ __ Hope this helps. Thank you


How do you display a text reversely in C language without using onlu simply input and output?

#include<stdio.h> #include<conio.h> void main() { char string[20]; int i=0; printf("Enter the string.\n"); while(i<=19) { scanf("%c",&string[i]); i++; } while(i>=0) { printf("%c",string[i]); i--; } getch(); } In this program it is compulsory to enter 20 characters. Now we can write a program in which it is not necessary. #include<stdio.h> #include<conio.h> #include<string.h> void main() { char string[20]; int length; printf("enter the string.\n"); gets(string); length=strlen(string); length--; while(length>0) { printf("%c",string[length]); length--; } getch(); }


Write a program to encrypt a string and decrypt it using your own method of encryption and decryption.?

We'll use a simple method of encryption: xor encryption // same function used to both encrypt and decrypt void crypt(char *str) { const int key = 0x86; // crypt each individual character of str int i; const int length = strlen(str); for(i = 0; i < strlen(str); ++i) { str[i] = str[i] ^ key; } }


Write a c program to copy the string without using strcpy?

use strcat, strncpy, stpcpy, sprintf, strlen+memcpy, etc


Write a C program to find the abbreviation of a full name without using string library function?

//C++ program to abbreviate first and middle name#include#include void main(void) { char name[40]; char abname[30]; int i,len,m=1,j=0; //puts is used to print string of characters //although cout is equivalent to it but gets //and cout should not be mixed in one program puts("Enter Name: "); //gets is used to take string input with spaces gets(name); //strlen is a built-in function, declared in //the string.h header file //it returns the length of a string len=strlen(name); abname[j++]=name[0]; abname[j++]='.'; abname[j++]=' '; for (i=0;i


Write a function to reverse a string and to display it?

Yes.


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


Write a program that give all the rotations of a string?

#include<stdio.h> #include<string.h> int main() { char a[80]; int rotated_element_number[80]; int rotation; int i; int length; printf("enter the word: \n"); gets(a); length = strlen(a); printf("the reversed string is:\n"); for( rotation=0; rotation<length; rotation++) { for( i=0; i<length; i++) { rotated_element_number[i] = i + rotation; while(rotated_element_number[i] > (length-1)) rotated_element_number[i] -= length; printf("%c", a[rotated_element_number[i]]); } printf("\t"); } getchar(); return 0; }


Write the function replace which finds the string from in the string string and replaces it with the?

Hay buddy this is homework. U have to solve it by urself.


How do you write a function called mystrlen that receives a pointer to a character string so that the function return the length of the string?

int mystrlen (const char *s) { const char *t; if (!s) return 0; for (t=s-1;*++t;); return t-s; }