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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:22:25+00:00 2026-05-20T14:22:25+00:00

Problem: Create an algorithm for a program that simulates a police radar gun. The

  • 0

Problem:
Create an algorithm for a program that simulates a police radar gun. The algorithm should read an automobile speed (in km/h) and print the message “Speeding” if the speed exceeds 59kmh. The algorithm should then also calculate the appropriate fine, $80 for 1-10kmh above the limit, $150 for 11-30kmh above the limit, $500 for 31kmh or more above the limit. Use the space below.

My solutions:

#include <stdio.h>
int main()
{
    int speed = 0;
    int limit = 59;

    /*Get automobile speed from user*/
    printf("Please enter the speed: ");
    scanf("%d%*c", &speed);
    /* Based on the speed, generates the corresponding fine*/
    if (speed > limit)
       {
        printf("Speeding");
        if((speed - limit) <= 10)
            printf("Fine: $80");
        else
            if((speed - limit) >= 11 & (speed - limit) <= 30)
                printf("Fine: $150");
            else
                if((speed - limit) >= 31)
                    printf("Fine: $500");
       }
    else
        printf("The automobile is not speeding");
    return (0);
}

The problem here is that it won’t print out the message “Speeding”.
Can anyone give me a hand?

  • 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-05-20T14:22:26+00:00Added an answer on May 20, 2026 at 2:22 pm

    printf is buffered when writing to stdout. Use fflush(stdout) after your printf functions, or add a new line, ie printf("Speeding\n");

    You can also disable buffering on the stdout stream by using setbuf(stdout, NULL);

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

Sidebar

Related Questions

The problem: To create a recursive array function that walks through a three dimensional
I have a problem to create a preprocessor macro function, that concatenates two Strings
I'm having a problem trying to create a Javascript function that checks all the
I have to create a program that finds all the possible ways of filling
I have started learning Java and am having problem with a simple program that
I'm trying to create a program that tracks stocks I own and adjusts the
I want to create a simple program that you open any given image and
I'm writing a program that solves an integral by Legendre-Gauss quadrature. The algorithm for
Can you advice me software to create flow-charts for program logic. My problem is
The Problem : I am trying to implement a search algorithm that shows the

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.