Welcome again!
The Codeclub, SMVDU
Any questions based on previous topics
Previous topics
- if-else
- loop
- while
- for
- array
Today's topic
-
Strings
-
Questions based on strings
What is String ?
String
In computer programming, a String is a sequence of characters.
or
A string is nothing but a character array.
A string is stored in an array of type char ending with the null character '\0 '
How to take input a string as an array
while(1){
scanf("%c",&a[i]);
if(a[i]=='\0'){
break;}
i++;
}
To scan:
char name[10];
scanf("%s",name );
To print:
printf("%s", name );
Write a program to take a string from user as input and print that string.
Write a program to find the length of a string.
Write a program to calculate the frequency of a character in a string. ( Take character from user)
sample input: i mritunjayvamsi
sample output: Frequency of i is : 2
Write a program to calculate no. of vowels and consonants in a string.
sample input:
programmer
sample output:
No of vowels: 3
No of consonants: 7
Copy of deck
By sandeep chauhan
Copy of deck
- 646