1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DaniilM [7]
2 years ago
6

Write a function called countstuff () that takes as a parameter a character array, and returns an int. The prototype must be:

Computers and Technology
1 answer:
PSYCHO15rus [73]2 years ago
5 0

Answer:

Please kindly go to the explanation part.

Explanation:

The required function is written in Raw code below.

Function:

#include<stdio.h>

#include<ctype.h> //including required libraries

int countstuff(char s[]){ //Function countstuff

int cntUp=0,cntLow =0,cntDigits = 0,i=0,value; //declaring required variables

for(i=0;s[i]!='\0';i++){ //loop to iterate over the characters of string

if(isupper(s[i])){

cntUp++; //incrementing count of uppercase if it is uppercase character

}

else if(islower(s[i])){

cntLow++; //incrementing count of lowercase if it is lowercase character

}

else if(isdigit(s[i])){

cntDigits++; //incrementing count of digits if it is digit

}

}

value = cntUp*1000000 + cntLow*1000 + cntDigits; //counting value using formula given in question

return value; //returning the value

}

void main(){

char string[1000]; //declaring required variables

int value;

printf("Enter a String:");

scanf("%[^\n]s",string); //taking string as input

value = countstuff(string); //calling function

printf("The Value is : %d\n",value); //printing result

}

You might be interested in
Which device protects computer systems from voltage fluctuations?
meriva
A fuse protects computer system from voltage fluctuations
6 0
2 years ago
Read 2 more answers
You receive an email from someone who claims to be a representative from your credit card company. The email asks you to click o
Tema [17]
B.) phishing
Definition of phishing:
Try to obtain financial or official information from internet users, usually sent as an email to look like it is from a legitimate company
6 0
3 years ago
2) State True or False. 1. Abacus is an electronic device. 2. ROM is read and writes memory of computer. 3. Header and footer ap
mr_godi [17]

Answer:

1 false

2 false

3 false

4  true

5 false

Explanation:

7 0
2 years ago
Read 2 more answers
Zachary is a member of Future Business Leaders of America at his school and is competing in the Impromptu Speaking competition.
Scrat [10]

Answer:

c start off with a story

Explanation:

I just took the test

4 0
2 years ago
Read 2 more answers
What would be the output of the following program?
Natalka [10]

Answer:

Output: 2004 2008 2058  

Explanation:

In the first printf command it will print the address of the variables num, msg1, msg2. And in the second printf command it will print the values of the variables num, msg1, msg2. As the address of the structure is 2004 And the size of the integer is 4 byte so size will increase with 4 bytes and the size of character is 1 byte so it will increase by 1*50= 50 bytes.

Hence, the output is 2004 2008 2058  

8 0
3 years ago
Other questions:
  • Explain how the principles underlying agile methods lead to accelerated development and deployment of software.
    6·1 answer
  • Write the execution steps if the input is a lion.
    11·1 answer
  • Insert a function in cell g5 to calculate the first student's monthly payment, using appropriate relative and absolute cell refe
    13·1 answer
  • What system calls have to be executed by a command interpreter? Why is it usually separate from the kernel?
    12·1 answer
  • Design the logic for a program that allows a usher to continuously enter numbers until the usher enters 0. Display the sum of th
    9·1 answer
  • What are MIDI signals?
    12·1 answer
  • What is the name for the size and style of text?
    8·2 answers
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
  • Please help me asapppp!​
    8·2 answers
  • Which cpu type would most likely be found in a smartphone?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!