-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlFlow.cpp
More file actions
51 lines (36 loc) · 762 Bytes
/
ControlFlow.cpp
File metadata and controls
51 lines (36 loc) · 762 Bytes
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
#include<stdio.h>
/*
int main()
{
char str[100];
printf("Enter the String : ");
scanf("%[^\n]s",str); // Accept String
printf("String is : %s ",str);
int i = 0;
getchar();
}
*/
int main()
{
int i = 0;
char name[2000];
int lines = 1;
printf("\nThe number of characters is: ");
while((name[i] = getchar())!='@')
i++;
printf("%d \n", i);
//printf("%s \n",name);
//if ((name[i] = getchar()) =' ')
//printf("End \n");
//printf("%s \n",name);
int j = 0;
int spaces = 0;
for (j=0;name[j];j++)
if (name[j] == ' ')
spaces++;
else if (name[j] == '\n')
lines++;
printf("Spaces %d lines %d ",spaces, lines);
//getchar();
return 0;
}