In: Computer Science
C programing language
write a program to count frequency of each letter, ignore case. Print the letter and frequency of each letter.
// 1A: . Ask the user to enter a password string, store it in pass. Password should contain atleast one Upper case, one Lower case letter , one of the 0-9 digits
(1)
#include<stdio.h>
int main(){
   FILE*fptr;
   fptr = fopen("data.txt","r");
   double sum=0;
   int count=0,value;
  
   while(fscanf(fptr, "%d", &value) != EOF){
       count++;
       sum+=value;
   }
  
   printf("Average value : %d\n",sum/value);
   fclose(fptr);
   return 0;
}
(2)
#include<stdlib.h>
int main(){
   char *dt = "The five boxing wizards jump
quickly";
   int count[26],i;
   for(i=0;i<26;i++)count[i] = 0;
  
   i=0;
   while(dt[i] != '\0'){
       char ch = dt[i++];
       if(ch >= 'A' && ch
<='Z')count[ch-'A']++;
       if(ch >= 'a' && ch
<='z')count[ch-'a']++;
   }
  
   for(i=0;i<26;i++){
       if
(count[i]!=0)printf("%c-%d\n",(i+'a'),count[i]);
   }
   return 0;
}
(3)
#include<stdio.h>
#include<string.h>
int main(){
   char password[25];
   int upper,lower,digit,i;
  
  
   while(1){
       upper=0;lower=0;digit=0;
       printf("Enter password : ");
       scanf("%s",password);
  
      
for(i=0;i<strlen(password);i++){
           char ch =
password[i];
           if(ch>='A'
&& ch<='Z')upper++;
           if(ch>='a'
&& ch<='z')lower++;
           if(ch>='0'
&& ch<='9')digit++;
       }
      
       if(upper>0 && lower>0
&& digit>0)break;
       else{
           printf("Invalid
password. Re-enter Password\n");
       }
   }
  
   printf("\nPassword : %s",password);
   return 0;
}