You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<stdio.h>
int main()
{
char str1[30],str2[40];
printf("Enter First String : ");
gets(str1);
printf("Enter Second String : ");
gets(str2);
strcat(str1,str2);
printf(" %s ", str1);
}
Contenation Not Using libary Function.
#include<stdio.h>
int main()
{
char str1[50] , str2[50];
printf("Enter First String : ");
gets(str1);
printf("Enter Second String : ");
gets(str2);
int i=0,j=0,len=0;
while (str1[i]!= '\0')
{
i++;
len++;
}
while(str2[j] != '\0')
{
str1[len+j]=str2[j];
j++;
}
printf("%s",str1);
}
Problrm 6
Chakeing String Same or not Same
#include<stdio.h>
int main()
{
char str1[30], str2[30];
printf("Enter any String for First : ");
gets(str1);
printf("Enter any String For Second: ");
gets(str2);
int d = strcmp(str1,str2);
if (d == 0)
{
printf("Stings are Equal");
}
else
{
printf("String are Not Equal ");
}
}
Problrm 7
Swapping String With Temporary Variable;
#include<stdio.h>
int main()
{
char str1[30]="Bangladesh",str2[30]="India" ,temp[30];
printf(" Before Swapping\n STR1= %s \n STR2= %s ",str1,str2);
strcpy(temp,str1);
strcpy(str1,str2);
strcpy(str2,temp);
printf("\n\n After Swapping \n STR1= %s \n STR2= %s ",str1,str2);
}
Problrm 8
Counting Vowel,Consonent,Disit,Word other ;
#include<stdio.h>
int main()
{
char str[100], ch;
char i,vowel,consonant,digit,word,other;
printf("Enter any Sentence : ");
gets(str);
i=vowel=consonant=digit=word=other=0;
while((ch=str[i]) !='\0')
{
if ( ch == 'a'|| ch == 'e' || ch== 'i' || ch== 'o' || ch=='u'||
ch == 'A'|| ch == 'E' || ch== 'I' || ch== 'O' || ch=='U'
)
vowel++;
else if((ch>='a' && ch<='z') ||(ch>='A'&& ch <='Z'))
consonant++;
else if (ch>='0' && ch <='9')
digit++;
else if (ch== ' ');
word++;
//else
// other++;
i++;
}
word++;
printf("Number of Vowel %d \n",vowel);
printf("Number of Consonant %d \n",consonant);
printf("Number of Digit %d \n",digit);
printf("Number of Word %d \n",word);
printf("Number of Other %d\n",other);
}