In: Computer Science
Write assembly programs with the following I/O
Enter a sentence: Project No Three.
No. of uppercase letters = 3
No. of lowercase letters = 11
You can use c++ for the Inputting and outputting
//If you have any doubts please comment me
//I wrote c++ code only.....
//If you like my answer please Upvote
Code:
// c++ code for counting number of captial letters and lower
case letters
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
char arr[200];//this is for to take sentence
int upper_case=0,lower_case=0; //these variables for
to store how many upper cases and lower cases..
cout << "Enter a sentence: "<<endl;
int i;
gets(arr);
//Here we have to count number uppercase and
lower case letters..
while(arr[i]!=0){
if(arr[i] >=
'A' && arr[i] <= 'Z')//Here we check wether the letter
is upper case or not
{
upper_case++;//if
it upper case we increase the count
i++;
}
else if (arr[i]
>= 'a' && arr[i] <= 'z')//Here we check the lower
case letter condition
{
lower_case++;//if it is lower case we increase lower_case
i++;
}
else
{
i++;
}
}
//Now here print the values...
cout << "No.of Uppercase letters= " <<
upper_case << endl;
cout << "No.of Lowercase letters= "
<< lower_case<< endl;
}
Output: