• Предмет: Информатика
  • Автор: Павел199905
  • Вопрос задан 7 лет назад

Помогите изменить так,чтобы не было ошибки.Прошу:
#include<stdio.h>
int sum( int x, int y);
{
int s;
s=x+y;
return s;
}
int main()
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
z=sum(100,5);
printf("%d",z);
}
.............................

Вот комментарий:
cpp:3: error: syntax error before `{' token
cpp:5: error: ISO C++ forbids declaration of `s' with no type
cpp:5: error: `x' was not declared in this scope
cpp:5: error: `y' was not declared in this scope
cpp:6: error: syntax error before `return'

Ответы

Ответ дал: petyaGavrikov
0
#include <iostream>
using namespace std;

int sum( int x, int y)
{
return x+y;
}
int main()
{
int x,y,z;
scanf("%d%d",&x,&y);
z=sum(x,y);
printf("%d",z);
}

Пример:
100 5
105
Вас заинтересует