C Language String Questions
Qus:- how to enter the string and print them.
Ans:- gets(str);Qus:- how to enter the name and age and print them in full manner.
Ans:- gets(str);
Qus:- how to enter the string and print them with for loop.
Ans:- ("%c",str[i]);
Qus:- how to find the string length.
Ans:- l=strlen(str);
Qus:- how to enter the string and print them in upper case.
Ans:- ("%c",str[i]-32);
Qus:- how to convert integer to character. from 65 to 122 in c langugae?
Ans:- printf(“# ** %c = %d ** #”, i, i);
Qus:- write a program for lower case to upper case and upper case to lower case.
Ans:- if(str[i]>65 && str[i]<91) {printf(“%c”,str[i]+32);}
else {printf(“%c”,str[i]-32);}
Qus:- how to count the vovels and consonants in given string and print.
Ans:- for(i=0;i<l;i++) { printf("%c",str[i]);
if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]='o' || str[i]=='u')
{v=v+i;} //count vovel else
{c=c+i;} //count consonants
}
Qus:- how to copy one string to another?
Ans:- scrcpy(str2, str1);
No comments:
Post a Comment