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
Musya8 [376]
3 years ago
9

Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outpu

ts yes if every character is a digit 0-9. You may assume that the string does not contain spaces and will always contain less than 50 characters.Ex: If the input is:1995the output is:yesEx: If the input is:42,000 or1995!the output is:noHint: Use a loop and the isdigit() function (don't forget to include the ctype library).
Computers and Technology
1 answer:
ANEK [815]3 years ago
7 0

Answer:

#include <stdio.h>

#include <ctype.h>

int main(void) {

char data[50];

int i;

   printf("Enter data: ");

   scanf("%s", data);

 

for (i = 0; data[i] != '\0'; ++i){

 if(isdigit(data[i]) == 0){

  printf("\nno");

  return 0;

 }

}

printf("\nyes");

return 0;

}

Explanation:

Step 1 : Define variables and libraries

  • Variables:

           char data[50];

     int i;

  • Libraries:

           #include <stdio.h>

           #include <ctype.h>

Step 2:  Read the data and asign to variable:

       printf("Enter data: ");

       scanf("%s", data);

Step 3: Loop over the data :

       for (i = 0; data[i] != '\0'; ++i)

Step 4: Validate if the element is digit:

       if(isdigit(data[i]) == 0)

Step 5: If the element is not digit print no and finish the program:

               if(isdigit(data[i]) == 0){

  printf("\nno");

  return 0;

 }

Step 6: If all elements are digits print yes and finish the program:

       printf("\nyes");

return 0;

You might be interested in
Please help me I don’t know what I’m doing wrong.
Alinara [238K]

Answer:

Explanation:

I noticed the \n, \n will cause the new line break, delete it.

try code below:

<em>System.out.println(" " + " " + "NO PARKING");</em>

<em>System.out.println("2:00 - 6:00 a.m.");</em>

5 0
2 years ago
Me Completan Pliiiis
Brut [27]
Can you translate please i’ll help better
4 0
3 years ago
What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
Mamont248 [21]

Different video files and operating system versions can cause compatibility issues to arise between computer systems.

Since, file formats and operating systems may not be compatible with each other. For example, earlier versions of Windows may not be able to play certain types of video files due to the codecs used to encode them.

<h3>Importance of compatibility between operating system computer systems</h3>

Compatibility between operating systems is important because it allows different computer systems to interact and share resources. This includes sharing of programs, files, and data.

Compatibility also allows users to access applications and services on different platforms. It also enables efficient use of hardware and software resources, as well as efficient use of resources in a network. Compatibility also ensures that computer systems can communicate with each other and can access the same resources. Without compatibility, it would be difficult for computer systems to interact with each other.

What are two compatibility issues that may arise between computer systems while transferring presentations? (Fill in the blank).

Different video files and _____ can cause compatibility issues to arise between computer systems.

Learn more about Compatibility between operating systems:

brainly.com/question/24760752

#SPJ4

4 0
1 year ago
3. In which of the following places can
maw [93]

Answer:

On the World Wide Web

Explanation:

Sure theres always a homepage somewhere. But i dont know what your researching so i went with c.

8 0
3 years ago
Read 2 more answers
Which statement will call this module and pass 12 as the argument?
WITCHER [35]

Answer:

Call showValue (12)

Explanation:

The function is a block of the statement which performs the special task.

if you define the function, then you have to call that function.

Then, program control moves to the function and start to execute otherwise not execute the function.

the syntax for calling the function:

name(argument_1, argument_2,....);

we can put any number of arguments in the calling.

check the options one by one for finding the answer:

Call showValue( Integer): this is valid calling but it passes the variable, not the 12. this is not correct.

Call showValue( Integer 12): This is not valid calling, because it passes the data type as well which is incorrect.

Call showValue( Real): this is valid calling but it passes the variable, not the 12. this is not correct.

Call showValue (12): this valid calling and also pass the value 12.

Therefore, the correct answer is option b.

6 0
2 years ago
Other questions:
  • For some people , alcohol can cause an uncontrollable blank of the eyes , making good vision almost impossible
    5·1 answer
  • 4. The same data source can be used multiple times in creating mail-merge documents.
    7·1 answer
  • In order to be accredited by the Better Business Bureau, a business is required to publish a privacy notice on its website that
    9·1 answer
  • keeping in mind the role in order of precedence plays in equations, what would excel display as the result of the following equa
    14·1 answer
  • ) Which is true about the agile method?
    7·1 answer
  • Write a structured algorithm that prompts the
    9·1 answer
  • Please please help I don’t understand this
    6·1 answer
  • Merging refers to dividing a single cell into multiple cells. *TrueFalse
    14·1 answer
  • What is cloud computing?
    13·2 answers
  • an engineer is writing a web application that requires some user input. the engineer has put a submit button on their page and n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!