Click here to Skip to main content
15,905,558 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I made this program for x-a expression where a is the value that will be entered by the user now how can I print this program till n times?
My code:
#include<stdio.h>

 int main() {
 int a,n;
char x; 

printf("enter value of a \n",a);
scanf("%d",&a); 


printf("Value of x is x %c\n",x);
n=x-a;
printf("x-%d",a);


 return 0;



 }


What I have tried:

I have made a code to print x-a
This is for my semester project I'm basically designing Taylor series general form for all polynomial function
Posted
Updated 15-Jul-22 19:23pm
v2

1 solution

You will need to add a loop - probably a for loop is best: C For Loop[^]

But I'd suggest you start by reading your homework question again carefully and trying to work out manually what you are expected to get as output - the question as stated here makes very little sense since x can never be unequal to itself.
That's like saying "where 6 is equal to 6"! It is always true, so it's irrelevant.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900