0
What happened to my code I don't know
#include<stdio.h> int sum(int a,int b); void printstar(int n){ for (int i=0;i<n,i++){ printf ("%c",'*'); } } int main() { int a,b,c; a=9; b=10; c=sum(a,b); printstar (7); //printf ("The sum is %d\n",c); } int sum (int a,int b); { return a+b; }
4 Answers
+ 1
Remove the ; on the sum function
+ 1
What is the objective of the code? What is it doing wrong?
Without this info, it's impossible to help.
0
It's still not fixed
0
#include<stdio.h>
int sum(int a,int b);
void printstar(int n){
for (int i=0;i<n;i++){ //see semicolon missing, instead you added camma
printf ("%c",'*');
}
}
int main()
{
int a,b,c;
a=9;
b=10;
c=sum(a,b);
printstar(7);
printf ("\nThe sum is %d\n",c);
}
int sum (int a,int b) //; remove colon
{
return a+b;
}
//what the program purpose? Does it working as needed ?