Facing compilation error why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Facing compilation error why?

I run this program on turbo c++ and its successful but on sololearn playground.. Its not giving output. https://code.sololearn.com/ce707Iue4300/?ref=app

10th Aug 2018, 5:25 PM
Nikita Desale
Nikita Desale - avatar
4 Answers
+ 2
I guess this is what you was expecting: https://code.sololearn.com/cV4pYmDlrL5U/?ref=app
10th Aug 2018, 6:18 PM
Ledio Deda
Ledio Deda - avatar
+ 2
There were a bunch of problems: 1. You were using some weird double quotes instead of these: "" 2. The syntax for "for loop" is: for(int i = 0; i<5; i++) {} 3. Some problems with variable names etc Check my try and ask about anything you don't understand✌
10th Aug 2018, 6:19 PM
Ledio Deda
Ledio Deda - avatar
+ 2
#include <stdio.h> int main() { int set1[5], set2[5], set3[5], i; printf("Enter elements of set1 : "); for(i = 0; i < 5; i++) { scanf("%d", &set1[i]); printf("%d ", set1[i]); } printf("\nEnter elements of set2 : "); for(i = 0; i < 5; i++) { scanf("%d", &set2[i]); printf("%d ", set2[i]); } printf("\nAddition of two sets :"); for(i = 0; i < 5; i++) { set3[i] = set1[i] + set2[i]; printf("%d ", set3[i]); } } Additionally to Lεd10 Dεda comments, please mind your code indentation, you'll thank yourself for keeping it right one day : )
10th Aug 2018, 7:04 PM
Ipang
0
>getch() xdd
10th Aug 2018, 8:36 PM
hinanawi
hinanawi - avatar