-
Notifications
You must be signed in to change notification settings - Fork 0
/
string1.c
72 lines (57 loc) · 1.62 KB
/
string1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include<stdio.h>
#include<string.h>
void salting(char pass[]);
void slice(char str1[],int n,int m);
int countvowels(char str[]);
void charcheck(char str[],char ch);
void main(){
char str1[100];
int i=0;
char ch;
for(i=0;ch!='\n';i++){
scanf("%c",&ch);
str1[i]=ch;
}
str1[i]='\0';
puts(str1);
char password[100];
printf("Enter Your Password :");
scanf("%s",&password);
salting(password);
char string[10]="HelloWorld";
slice(string,3,6);
printf("\n");
char str3[]="helloworld";
printf("Vowels are :%d\n",countvowels(str3));
char str4[]="Bhavesh";
char ch1='e';
charcheck(str4,ch1);
}
void charcheck(char str[],char ch){
for(int i=0;str[i]!='\0';i++){
if(str[i]==ch){
printf("Character is presnt ");
return;
}
}
printf("Character is not present ");
}
int countvowels(char str3[]){
int count=0;
for(int i=0;str3[i]!='\0';i++){
if(str3[i]=='a' ||str3[i]=='e' || str3[i]=='i' ||str3[i]=='o' || str3[i]=='u'){
count++;
}
}
return count;
}
void salting(char pass[]){
char salt[]="123";
strcat(pass,salt);
puts(pass);
}
void slice(char str1[],int n, int m){
for(int i=n;i<=m;i++){
printf("%c",str1[i]);
}
}