answersLogoWhite

0


Best Answer

#include<stdio.h>

bool is_digit (char c) {

return (c>='0' && c<='9');

}

bool is_upper (char c) {

return (c>='A' && c<='Z');

}

bool is_lower (char c) {

return (c>='a' && c<='z');

}

int main () {

char input[20];

printf ("Enter a 20 character string containing digits and letters: ");

scanf ("%s", &input); /* beware of buffer overflow */

for (int index=0; index<20; ++index) {

printf ("The character at index %d is ");

if (is_digit (input[index]))

printf ("a digit.\n");

else if (is_upper (input[index]))

printf ("an uppercase letter.\n");

else if (is_lower (input[index])) printf ("a lowercase letter.\n");

else

printf ("a non-alphanumeric character.\n");

}

return 0;

}

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a c program to accept 20 characters and display whether each input given is a digit a lower case or upper case using only arrays and while loops and for loops?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Draw a flowchart that will accept radius and display the area of circle?

program that display the area of a circle of a reduce


Write a program in COBOL to find the largest of N number?

identification division. program-id. greatest. environment division. data division. working-storage section. 77 a pic 999. 77 b pic 999. 77 c pic 999. procedure division. greatest. display "ENTER THE THREE NUMBERS:". accept a. accept b. accept c. if a &gt; b and a &gt; c display a "is greatest" else if b &gt; c display b "is greatest" else display c "is greatest". display " thank you". stop run.


Accept 5 numbers in an array and display it?

Accept 5 numbers in an array and display it.


Write a C program to accept a string from user and display its ascii value and then display sum of all ascii value of strings?

//C program to accept a string from user and //display its ascii value and //then display sum of all ascii value of strings #include&lt;stdio.h&gt; #include &lt;string.h&gt; int main() { char String[100]; int Sum,Index; Sum=0; //Sum is initially zero printf("Enter the string:\n"); gets(String); //Accept String from User for(Index=0;Index&lt;strlen(String);Index++) { Sum+=(String[Index]); //Adds (the ASCII values of) the String characters. } printf("The sum is %d\n",Sum); //Printing it as %d gives the equivalent ASCII value. return 0; }


Design an algorithm that will accept a perons name from the screen entered as surname first name separated by a comma Your program is to display the name as first name followed by three blanks?

Design an algorithm that will accept a perons's name from the screen entered as surname, first name, separated by a comma. Your program is to display the name as frist name, followed by three blanks, followed by the surname. -defining diagram -pseudocode algorithm


Write a program to accept 2 numbers and tell whether the product of the two number is equal to or greater than 1000?

C programm


Write C program for Accept temperature in degree Celsius and display the same in Fahrenheit?

The variable, X, has to undergo the following: X*9&divide;5+32 [The reverse would be to accept a Fahrenheit temperature: (F-32)*5&divide;9]


Write a c program using while loop to accept a number check and display message whether number is perfect or not?

The program is here guys.......... //Finding whether the given number is perfect or not //Starts here #include&lt;stdio.h&gt; void main() { int i=1,temp=0,number; scanf("%d",&amp;number); while(i&lt;=number/2){ if(number%i==0) temp+=i; i++; } if(temp==number) printf("Its a perfect number"); else printf("Its not a perfect number"); } //ends here


What Part of speech accept?

'Acceptable' is an adjective: 'He did not display an acceptable standard of behaviour.'


Can you co sign for an apartment if you live out of state?

That would be up to the owner of the property whether they would accept you as a co-signer.That would be up to the owner of the property whether they would accept you as a co-signer.That would be up to the owner of the property whether they would accept you as a co-signer.That would be up to the owner of the property whether they would accept you as a co-signer.


Draw a flowchart to accept 3 numbers and display the largest number?

draw a flowchart to display the first tenth even number


A flowchart to Accept three numbers and check whether it firms to Pythagorean triplet?

Accept 3 natural numbers and check whether it firms pythagorean triplet