#include <stdio.h>
int main ()
{
int c = 0;
char ch, s[1000];
printf("Input a string\n");
gets(s);
while (s[c] != '\0') {
ch = s[c];
if (ch >= 'A' && ch <= 'Z')
s[c] = s[c] + 32;
else if (ch >= 'a' && ch <= 'z')
s[c] = s[c] - 32;
c++;
}
printf("%s\n", s);
return 0;
}
#include<stdio.h>
#include<conio.h>
void main()
{
char str[1000];
int i=0,digit=0;
printf("Enter the string to find number");
gets(str);
while(str[i]!='\0')
{
if(str[i]>=48 && str[i]<=57) //48 is for 0 and 57 is for 9 in ASCII notation
{
digit++;
}
}
printf("\n The number of digits in the given string is \n%d",digit);
getch();
}