Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Have an account? Sign In

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Tech Answered Logo Tech Answered Logo
Sign InSign Up

Tech Answered

Tech Answered Navigation

  • Home
  • Tutorials
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home / Questions /Q 1176
Next
In Process
Rekha kumari
Rekha kumari

Rekha kumari

  • India
  • 1 Question
  • 2 Answers
  • 0 Best Answers
  • 25 Points
View Profile
  • 0
Rekha kumari
Asked: December 15, 20202020-12-15T12:43:03+05:30 2020-12-15T12:43:03+05:30In: C Language

How to print all characters from a string in C.

  • 0

I want to print characters only from input string
If input contains characters, numbers and special symbols then output contain characters only. For example if input string is ” Shi&+358@57rek” Then output will be “shirek”.

Will anyone please help me?

c program only to print characters
  • 1
  • 539
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • c keep asking for input how to write a program that asks user input
    • How do you find the factorial of a number in C using while loops?
    • What Is A "null Pointer Assignment" Error? What Are Bus Errors, Memory Faults, And Core Dumps?
    • What is OOPs concept in C++ with examples?
    • What is the use of github?
    • How to fix broken commit
    • in turbo c how to change the cursor

    1 Answer

    1. Nadiminti Naga Satya Veni
      2021-07-27T13:45:10+05:30Added an answer on July 27, 2021 at 1:45 pm

      Here,is the program to print only characters from a string.If input contains characters,numbers and special symbols in C Language:

      #include <stdio.h>

      int main() {
      char line[150];

      printf(“Enter a string: “);
      fgets(line, sizeof(line), stdin); // take input

      for (int i = 0, j; line[i] != ‘\0’; ++i) {

      // enter the loop if the character is not an alphabet
      // and not the null character
      while (!(line[i] >= ‘a’ && line[i] <= ‘z’) && !(line[i] >= ‘A’ && line[i] <= ‘Z’) && !(line[i] == ‘\0’)) {
      for (j = i; line[j] != ‘\0’; ++j) {

      // if jth element of line is not an alphabet,
      // assign the value of (j+1)th element to the jth element
      line[j] = line[j + 1];
      }
      line[j] = ‘\0’;
      }
      }
      printf(“Output String: “);
      puts(line);
      return 0;
      }

      In Above Program,It takes a string input from the user and stores in the variable line. And then a for loop is used to interate over the characters of the input string.If the characters in a string are not an alphabet,then it will remove from the given input string and position of the remaining characters are shifted to the left side one by one

      I Hope this answer helped you.

      Thank you!

      • 1
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Related Questions

      • Answers: 0

      c keep asking for input how to write a program

      I want to write a C program if the user to input something which a given condition. For example I want to write the user  put a real number. Until user inputs real number C program should ask for the

      • Answer: 1

      How do you find the factorial of a number in

      I got to see programming assignment where I need to find factorial for a given number.  How do we find the factorial of a number in C using while loops? And there was a condition like I should only use loops

      • Answer: 1

      What Is A "null Pointer Assignment" Error? What Are Bus

      What Is A "null Pointer Assignment" Error? What Are Bus Errors, Memory Faults, And Core Dumps?Is there any way to overcome these errors? if yes what are the ways and how can we do it?

      • Answers: 2

      What is OOPs concept in C++ with examples?

      Iam a "c"  language learning now, because of this reason I want information about opps concept in C++ with examples? Please give me a answer this question

      • Answer: 1

      What is the use of github?

      What is the use of Github? Can we use Github? uses of Github? How to use Github? Who uses GitHub?

    Stats

    • Questions 1,882
    • Answers 1,966
    • Posts 8
    • Best Answers 71

    Recent Questions

      • Answer: 1

      Can't change Instagram password try again later fix

      I try to change the Instagram password but I am unable to change. To give

      • Answer: 1

      How do you reset your Snapchat account password without a

      Is there a way to login to Snapchat account without any email and phone number.

      • Answer: 1

      How to snapchat account recovery without phone number

      I couldn't login to my Snapchat account I don't know whether my Snapchat account is

      • Answer: 1

      benefits of microsoft teams for teachers

      In a school organization what are some useful benefits of having Microsoft teams. I want

      • Answer: 1

      Gifts for teachers from students unique and impressive

      This year we are going to be parted from my school as I completed my

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help

    Footer

    Recent Comments

    • Latha on Can’t change Instagram password try again later fix
    • dynamicapps5 on How do you reset your Snapchat account password without a phone number or email account?
    • Sailu on How to snapchat account recovery without phone number
    • Likitha on benefits of microsoft teams for teachers
    • sita on Gifts for teachers from students unique and impressive
    Ask A Question

    Archives

    Tags

    android 11 release date (1) Google News App (1) if x+y+z=0 show that x3+y3+z3 is equal to (1) if x+y+z=0 show that x3+y3+z3=3xyz (1) if x+y+z=0 show that x3+y3+z3=3xyz solution (1)

    Social media

    © 2021 @ Techanswered.com.
    Terms, Privacy policy & Sitemap.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.