Computer Science, asked by Anannya6298, 1 year ago

Change the case of alphabets and replace all the digits by $ in target file

Answers

Answered by Anonymous
0

Write a java program to copy the contents of one file into the another file, while copying change the case of alphabets and replace all the digits by '*' in target file.

Answered by Ᏸυէէєɾϝɭყ
2

Answer:

Explanation:

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#define str_size 100 //Declare the maximum size of the string

void main()

{

char str[str_size];

int alp, digit, splch, i;

alp = digit = splch = i = 0;

printf("\n\nCount total number of alphabets, digits and special characters :\n");

printf("--------------------------------------------------------------------\n");

printf("Input the string : ");

fgets(str, sizeof str, stdin);

/* Checks each character of string*/

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')

{

digit++;

}

else

{

splch++;

}

i++;

}

printf("Number of Alphabets in the string is : %d\n", alp);

printf("Number of Digits in the string is : %d\n", digit);

printf("Number of Special characters in the string is : %d\n\n", splch);

}

Similar questions