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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:27:39+00:00 2026-06-02T16:27:39+00:00

#include <stdio.h> #include <math.h> long int input; long int base, exponent; void convert(long int

  • 0
#include <stdio.h>
#include <math.h>

long int input;
long int base, exponent;

void convert(long int x,long int y)
{
    input = x;
    base = y;

    while (input > 0){
        exponent = floor(log(input)/log(base));
        input = input - pow(base, exponent);
    }
}

int main(void){
    scanf("%d", &input);
    scanf("%d", &base);
    convert(input, base);
}

I was trying to compile the code above to see if I can convert decimal into different bases, but I get the following error:

assignment2.c(14): error C2143: syntax error : missing ';' before 'type'

I have been struggling for hours, but I have no idea what this is referring to. How can I fix this?

EDIT: this is the whole message

1>------ Build started: Project: assignment2, Configuration: Debug Win32 ------
1>Build started 2012-04-27 오후 5:45:10.
1>InitializeBuildStatus:
1>  Touching "Debug\assignment2.unsuccessfulbuild".
1>ClCompile:
1>  assignment2.c
1>c:\users\조화수\documents\visual studio 2010\projects\assignment2\assignment2\assignment2.c(14): error C2143: syntax error : missing ';' before 'type'
1>  assign2.c
1>c:\users\조화수\documents\visual studio 2010\projects\assignment2\assignment2\assign2.c(13): warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
1>c:\users\조화수\documents\visual studio 2010\projects\assignment2\assignment2\assign2.c(14): warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
1>c:\users\조화수\documents\visual studio 2010\projects\assignment2\assignment2\assign2.c(19): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
1>c:\users\조화수\documents\visual studio 2010\projects\assignment2\assignment2\assign2.c(20): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
1>  Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.98
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  • 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-02T16:27:41+00:00Added an answer on June 2, 2026 at 4:27 pm

    pow and log expect double or float. With a cast it works for me:

    exponent = floor(log((double)input)/log((double)base));
    input = input - pow((double)base, (double)exponent);
    

    Initially I got an error stating that the compiler couldn’t resolve an ambiguity between various oveloads (on VS 2008)

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

Sidebar

Related Questions

Below is my code: #include <stdio.h> #include <math.h> void main () { int my_data[4][500];
#include <stdio.h> #include <math.h> int main (void) { float inches; printf(Enter the number of
#include<stdio.h> #include<time.h> int main() { clock_t start; double d; long int n,i,j; scanf(%ld,&n); n=100000;
#include<stdio.h> #include<math.h> int main () { FILE *fp; fp=fopen(output,w); float t,y=0,x=0,e=5,f=1,w=1; for (t=0;t<10;t=t+0.01) {
I have this code: #include <stdio.h> #include <math.h> #define gridSize 400 void main() {
#include <stdio.h> #include <math.h> /* converts to binary using logs */ int main() {
#include <stdio.h> #include <math.h> /* converts to binary */ int main() { unsigned int
#include <stdio.h> #include <string.h> #include <math.h> #define NUM 8 int main() { int i,
#include stdafx.h #include stdio.h #include math.h int main() { float c; printf(Type c); scanf(%f,
#include stdafx.h #include stdio.h #include math.h #include stdlib.h void test (int a,int *b, int

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.