What's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's wrong with my code?

Q:-Write a C program to multiply three numbers and print the result. Here two numbers have to be taken through assignment statements and the third as a user input. My code #include <stdio.h> void main() { int a=7,b=8,c,d; printf("input third number"); scanf("%d", &c); d = a*b*c; printf(" product = %d", d); }

6th Sep 2023, 10:29 AM
Sohini Giri, Sec A,Roll No.-05
Sohini Giri, Sec A,Roll No.-05 - avatar
2 Answers
+ 7
Sohini Giri, Sec A,Roll No.-05 Your code is correct.. but, Just change in second line.. Use this `int main()`,instead of `void main`, because this program execute an integer value.
6th Sep 2023, 10:46 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
please write 'int main()' instead of 'void main()'
7th Sep 2023, 9:52 PM
Fabian Roy
Fabian Roy - avatar