Professional Documents
Culture Documents
GradedLab-1 CSF401 Mahul Sethi 200102001
GradedLab-1 CSF401 Mahul Sethi 200102001
School of Computing
Graded Lab-1
void main()
{ char
str[str_size
];int alp,
digit, spch,
i; alp =
digit = i =
0;
spch=-1;
while(str[i]!='\0')
{
if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z'))
{
alp++;
}
else if(str[i]>='0' && str[i]<='9')
Mahul Sethi 200102001 1000014223
{
digit++;
}
else {
spch++;
}
i++; }
Output:
Mahul Sethi 200102001 1000014223
int main() {
printf("Enter the
String: ");
scanf("%[^\n]s",
&str);
printf("\n
Output:");
if (str[0]
== '/') {
+ 1] == '/') { printf("Comment");
x = 1;
break; }
else
Continue
Mahul Sethi 200102001 1000014223
if
(x == 0) {
printf("Err
or");
} else {
printf("Error");
} else {
printf("Er
ror"); }
return 0;
Output
Mahul Sethi 200102001 1000014223