I Need a Code for multiplication of 2 written numbers in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I Need a Code for multiplication of 2 written numbers in C

Here is my code I am new in learning C soo I dont the proper and right code help me what changes should I make in code and why its not working now??? #include<stdio.h> int main() { int a; float b; a=54; b=26; printf(a×b); return 0; } And I also want too know that how to set memory for a value?

29th Nov 2022, 7:32 AM
Ketan Gehlot
Ketan Gehlot - avatar
2 Answers
+ 7
https://code.sololearn.com/cDbMIuWA4vp0/?ref=app Go through c lessons for basic syntax Float accepts decimal values..so I changed it to int.
29th Nov 2022, 7:50 AM
Riya
Riya - avatar
+ 4
printf("%d",a*b) for integer value output by compiler by computing a*b here * is different from × which is simple calculation. Both input value should be in one datatype (like in int otherwise double) int a; int b; Or double a ; double b; It's due to their different bytes stored by int , double and other datatypes So i think you should learn from basics with every modules completing do coding you can easily grasp all this language as least day with a good knowledge. https://www.sololearn.com/Course/C/?ref=app So keep learning Thank you!!
29th Nov 2022, 7:59 AM
Sâñtôsh
Sâñtôsh - avatar