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
Sever21 [200]
3 years ago
6

Write a program to check if an input is a valid hashtag (starts with #, contains only letters, numbers, and underscore, no space

or special characters).
(1) Name your program hashtag.c.
(2) The user input ends with the user pressing the enter key (a new line character).
(3) Library function isalpha(), isdigit(), and isalnum() are not allowed in this program.
(4) Use getchar() to read in the input.
Computers and Technology
1 answer:
adell [148]3 years ago
8 0

Answer:

C code is given below

Explanation:

#include<stdio.h>

int main()

{

  printf("Input:");

  int ch;

  int valid=1; // it is set as 1 initially if anything is wrong it is changed to 0

  ch=getchar();

  if(ch!='#') // it checks if it starts with #

  {

      valid=0;

  }

while((ch = getchar())!= '\n') // this loop runs till line ends

  {

if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')||(ch>='0'&&ch<='9')||(ch=='_')) // if conditions are matched then its okay

{

   

  }

  else // else valid is changed to 0 from 1

  {

     valid=0;

  }

}

if(valid==0) // if anywhere there is anything wrong then it prints not valid

{

  printf("It is not valid hashtag");

  }

  else // else prints valid

  {

      printf("It is a valid hastag");

  }

}

You might be interested in
hi Let's say you graduate from school and you are unemployed or take a low-paying job. What are your debt repayment options if y
maks197457 [2]

Income-Based Repayment would be one of your repayment options.

IBR is an option similar to Pay As You Earn but offers more flexibility. To qualify for an IBR, your prospective payments must be lower than they would be on the Standard Repayment Plan. You can still sign up for an IBR even if you are still unemployed. These plans are solely based on your income. So if you are unemployed, this translates to zero income. As a result, your monthly payment will be $0

4 0
4 years ago
Read 2 more answers
What is the new subnet mask in prefix format?
vodomira [7]

In the case above, the the new subnet mask in prefix format is seen in IPv6 and in IPv4.

<h3>What is subnet prefix mask?</h3>

A lot or a single computer that is known to be linked to a subnet is said to shares a kind of an identical part of the IP address.

Note that this shared information is said to be called the  routing prefix, and in IPV4 (Internet Protocol Version 4), the routing prefix is said to be called a subnet mask.

Hence, The the new subnet mask in prefix format is seen in IPv6 and in IPv4 because that is the format that it always comes in.

Learn more about subnet from

brainly.com/question/8907973

#SPJ1

3 0
2 years ago
Joanna accidentally leaned on her keyboard and repeatedly typed the letter z. How can she fix this mistake?
Brut [27]

Answer:

just press delete

Explanation:

5 0
3 years ago
Read 2 more answers
Most operating systems today primarily use a ____.
LenKa [72]
Screen made of pixels? Right?
3 0
4 years ago
Jarvis wants to buy a basic scanner for daily use. Which scanner will be suitable for him?
Romashka-Z-Leto [24]

Answer:

A

Flatbed scanner often come with sheet feeders for scanning multiple sheets of paper rather than one at time

8 0
3 years ago
Read 2 more answers
Other questions:
  • Debuted by the Lumiere Brothers, a hand cranked device that showed moving pictures to an audience​
    7·1 answer
  • 8. _______ are used to store all the data in a database.
    7·2 answers
  • When a manager is told that it's acceptable to take credit for work that junior
    11·1 answer
  • A user is attempting to access a shared file locally on their workstation. The file has Full control NTFS permissions assigned,
    14·1 answer
  • What are the three primary components of an inbox?
    11·1 answer
  • The cost of an items is Rs 200. what will be the cost of 50 such items. write a simple program​
    10·1 answer
  • Type the correct answer in the box.
    15·1 answer
  • State two differences between a mouse pointer and a mouse cursor​
    10·2 answers
  • Given a list of integers. find the size of the list
    7·1 answer
  • What are the effects of information systems in the management of corona ?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!