What happened to my code I don't know | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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; }

25th Dec 2021, 2:28 PM
Bong Rush Gaming YT
4 Answers
+ 1
Remove the ; on the sum function
25th Dec 2021, 3:08 PM
SITHEMBISO
+ 1
What is the objective of the code? What is it doing wrong? Without this info, it's impossible to help.
25th Dec 2021, 4:52 PM
Emerson Prado
Emerson Prado - avatar
0
It's still not fixed
25th Dec 2021, 4:21 PM
Bong Rush Gaming YT
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 ?
25th Dec 2021, 4:54 PM
Jayakrishna 🇮🇳