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
Excel Enterprises uses a Web​ site, online social​ networks, and print advertisements to promote its products. Since Excel Enter
Nuetrik [128]

Answer:

Consistency

Explanation:

Bi integrating marketing communications, we can infer that the different brands working under Excel Enterprises have the same basic design, so the marketing department can sell their features easily, without having to create different campaigns or protocols for each individual product.

This homogeneous design then turns intuitive for the user, a textbook definition of consistent design, and the tone is maintained through the different brands.

Just like when you move from Microsoft's Excel to Microsoft's Word, you know the usage of each program is different, but the layout is the same, allowing you to understand the basics of the UX (user interface) of one, by understanding the other.  

4 0
3 years ago
Read 2 more answers
ou have a company network that is connected to the internet. You want all users to have internet access, but you need to protect
Rus_ich [418]

Server and network is 2 different things, just put the server on a different network.  ;) duh

Explanation:

4 0
3 years ago
How can you quickly access the desktop when you have many applications open.
murzikaleks [220]

Answer:

Clear all your cookies and browing data or delete the tabs that u have or do a clean up of your desktop every once in a while it say it will clean my laptop so it throw out all the trash stuff that is in it so baiscally it mean that it'll reset it.

4 0
2 years ago
In which situations would a text-to-speech tool be useful? Check all that apply. O A reader needs to hear a word pronounced. A s
spin [16.1K]

Answer:

The answer to this question is given below in the explanation section

Explanation:

The correct answer is :

A reader needs to hear a word pronounced

A student needs to take notes about a text

Because, text to speech tools mostly used to hear the text written in some files such as reading text from pdf file etc, or word pronunciation. However other options are not right because, reading a difficult material does not make sense with reading it links to understanding.

However, speech to text can be used by the student to take notes while listening the text, but would be easy instead of taking notes and listening, it is easy to copy the text.

7 0
3 years ago
Read 2 more answers
What's it called when a program is expandable?
sashaice [31]
Its called a genesis program
6 0
3 years ago
Other questions:
  • What exactly is a byte? A byte is a term that is short for binary digit. 8 bytes hold about one letter, one number, or one speci
    10·1 answer
  • How to make a sad face on keyboard using alt?
    5·2 answers
  • Which of the following statements is true? Methods and instance variables can both be either public or private. Information hidi
    11·1 answer
  • sandra has houseplants sitting on her kitchen windowsill, where it receives a lot of sunlight . what will most likely be the pla
    9·2 answers
  • JAVA
    7·1 answer
  • ____ a device receiving a process variable
    12·1 answer
  • Which type of file can be opened directly into Excel?
    15·1 answer
  • Based on the following quote from Leonardo Da Vinci, what would be his definition of a fine artist? “Principles for the Developm
    11·2 answers
  • Who is the first computer programmer​
    14·2 answers
  • Why is it important to continiously conduct penetration testing for a strong security system?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!