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

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

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

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

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

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8188271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:51:04+00:00 2026-06-07T02:51:04+00:00

I seek for an expert in c programming. Thanks in advance. Example: #include <stdio.h>

  • 0

I seek for an expert in c programming. Thanks in advance.

Example:

#include <stdio.h>
#include<stdlib.h>
#include<ctype.h>

void main()
{
char name[100][52],selection[2]="Y";
int x,nname=1;
float sales;

do
{
    printf("Enter name: ");
    fflush(stdin);
    fgets(name[nname],51,stdin); // i need put a wrapper in here
    printf("Enter sales: ");
    scanf("%f",&sales);
    if (sales<1000)
        printf("%s\tgood\n",name[nname++]);
    else
        printf("%s\tvry good\n",name[nname++]);
    printf("Enter another name?(Y/N)");
    fflush(stdin);
    fgets(selection,2,stdin);
    *selection=toupper(*selection);
}while(nname<=100 && *selection=='Y');
for(x=1;x<nname;x++)
    printf("%s\n",name[x]); // want print the result without(newline) /n

printf("END\n");
system("pause");
}

How do I print the names without being separated by new lines?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:51:06+00:00Added an answer on June 7, 2026 at 2:51 am

    Just use

    printf("%s ", name[x]);
    

    instead of

    printf("%s\n", name[x]);
    

    The \n character is creating the new lines.

    Edit

    fgets apparently reads newlines into the buffer – you can strip the newline with

    name[nname][strlen(name[nname])-2] = '\0';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented multiple seek bar in android like @Override public void onCreate(Bundle savedInstanceState)
I seek how to retrieve the id of the profile album facebook I found
When I seek for information regarding GWT I find a lot of java examples.
I'm trying to seek to a specific part of a video, and I'd like
I would like seek some guidance in writing a process profiler which runs in
I am quite new to groovy and seek your help. I want to read
If I want to implement seek() to complete the SeekableIterator interface, should I internally
I am using MFC CFile Seek function. I have a problem about Seek out
The following query uses an index seek on an index on the LastModifiedTime column.
def file_open(filename): fo=open(filename,'r') #fo.seek(5) fo.read(3) fo.close() file_open(file_ro.py) I expect above program to return first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.