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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:11:30+00:00 2026-06-05T07:11:30+00:00

When I am getting some problem why time1 variable getting zero. right after calculation

  • 0

When I am getting some problem why time1 variable getting zero. right after calculation of floor.

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
   int curfl = 0, destfl, floor;
   int time1, high, speed;
   high = 3;
   speed = 5;
   while(1)
   {
       printf("Currently the elevator is at floor number = %d\n", curfl);
       printf("Enter the floor number between 0-25 : ");
       scanf("%d", &destfl);
       if(destfl > curfl)


       {
               floor = destfl - curfl;
                /*****************************/
               time1 = (floor * (high / speed));  //variable become zero here
               /*****************************/
               printf("Elevator will take %d second to reach %d (st, nd, rd) floor \n", time1, destfl);
               while(curfl != destfl)
               {
               Sleep(1000 * 3 / 5);
               curfl++;
               printf("You are at floor number %d \n", curfl);
           }
           printf("Door opening \n");
           Sleep(10000);
           printf("Door Closed\n");
       }
       else if(destfl > curfl)
       {
           floor = curfl - destfl;
           time1 = (floor * (3 / 5));
           printf("Elevator will take %d second to reach %d (st, nd, rd) floor \n", time1, destfl);
           while(curfl != destfl)
           {
               Sleep(1000 * 3 / 5);
               curfl--;
               printf("You are at floor number %d \n", curfl);
           }
           printf("Door opening \n");
           Sleep(10000);
           printf("Door Closed\n");
       }
       else{
           printf("You are the same floor. Please getout from the elevator \n");
       }
}
   // printf("Hello world!\n");
    return 0;
}
  • 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-05T07:11:31+00:00Added an answer on June 5, 2026 at 7:11 am

    You are doing integer calculations. Switch to something that handles fractions.

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

Sidebar

Related Questions

after some advice regarding a problem i am getting using a linux based piece
I have problem with getting value of parameter when I have variable with some
I'm having some problem getting text with special characters (Swedish: åäö) from the database.
i am getting problem as i have some data in a database tabel file
For some reason I was getting a dramatically incorrect answer for a problem, so
I have a problem with getting my pager-function to work. For some reason it
I am getting this annoying problem, whenever i do some changes to any file
I have a slight problem with getting the options within the select tag. Some
I'm some trouble finding the problem with my program. Getting the error: Use of
getting some problem into my spring application. I have very fairly simple spring beans,

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.