+ 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
4 ответов
+ 2
I guess this is what you was expecting:
https://code.sololearn.com/cV4pYmDlrL5U/?ref=app
+ 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✌
+ 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 : )
0
>getch()
xdd