PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 17, 2022

[FIXED] Why is my printf function to calculate polynomial not shown in the the command output?

 August 17, 2022     c, function, output     No comments   

Issue

I'm just learning the C programming language . Could you explain to me why isn't my output produced?

#include <stdio.h>
int main (void)
{
    int x , total ;
    printf("Enter the value of x : ");
    scanf("%i\n", x);
    total = (3 * x * x * x * x * x) + (2 * x * x * x * x) - (5 * x * x * x) - (2 * x * x) + (7 * x) - 6;
    printf("Total value of the polynomial is %i\n", total);
    return 0 ;
}


Solution

Change the scanf to:

   scanf("%i", &x);

You need to pass in the address of x to assign it a value from the scanf function. Also no \n



Answered By - OldProgrammer
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing