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 7719377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:24:05+00:00 2026-06-01T03:24:05+00:00

I want to extend the functionality of a part of a program that I’m

  • 0

I want to extend the functionality of a part of a program that I’m working now..

Right now my code prints this on screen:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
1999

But I’m looking to do this: Putting the tens in text, without number. Also, numbering tens.

1
2
3
4
5
6
7
8
9
ten 1
11
12
13
14
15
16
17
18
19
ten 2
21
22
...
1999

But with the functions that I know of C, I can’t figure how to do.
Could do this with many ifs in the for, but do not want a code so extensive.

The code of the first output is this:

#include<stdio.h>

int main(void) {

    int i, j=2000;

        for(i=1;i<=j;i++)
        {
            printf("%d\n", i);

        }

    return 0;
}

Very simple, and I want to keep that.

IN SIMPLE WORDS: All numbers ending in 0, should be print “ten x”, instead the number…

Thank you.

  • 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-01T03:24:07+00:00Added an answer on June 1, 2026 at 3:24 am

    To find out if a number n is divisible by ten, you use:

    if ((n % 10) == 0) ...
    

    That’s the modulo operator which returns the remainder when n is divided by ten – numbers divisible by ten have a remainder of zero when you do that, all other numbers have a remainder of one through nine (at least in the non-negative space which is where you’re working – it may be different for negative numbers but I’m not going to check since it’s not relevant here).

    To find which number you need to output with your "ten" string, simply divide n by ten.

    So you print statement will become something like:

    if ((i % 10) == 0)
        printf ("ten %d\n", i / 10);
    else
        printf ("%d\n", i);
    

    Making that change gives you the output:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    ten 1
    11
    12
    :
    1988
    1989
    ten 199
    1991
    1992
    1993
    1994
    1995
    1996
    1997
    1998
    1999
    ten 200
    

    which appears to be what you’re after.


    And just one other point, your output appears to stop at 1999 rather than 2000, despite the code. If that’s what you really want, either change j to be 1999 or change the for statement to use < instead of <=.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to extend a WPF application with database functionality. Which database engine would
I want to extend the IEnumerable class but only for types that can be
I have a class that I want to extend the WPF Window class. I
I have a Django template that I want to extend in multiple places. In
I have a SVG file that I want to extend by adding onclick handlers
In following code, I want to extend the behaviour of a class by deriving/subclassing
I want to extend the asp.net validators such that I can make one validator
I want to extend the functionality of the ImageButton class, in a new class
I want to extend DbGrid functionality to add colors on odd and even rows.
I made this loader which actually works pretty well. I now want to make

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.