What did I do wrong here? It tells me that the "std::cout<<"n="; std::cin>>n;" line is wrong and says "expected initializer before "std"".Write your question here.
#include <iostream>
int main()
{
int n,a,b,c,s; //was missing a semicolon here
std::cout << "n = ";
std::cin >> n;
a = n / 100;
b = n / 10 % 10;
c = n % 10;
s = a + b + c;
std::cout << "\nThe digits sum is: " << s;
return 0;
}
#include <iostream>
int main()
{
int n, a, b, c, s
std::cout << "n="; std::cin >> n;
a = n / 100;
b = n / 10 % 10;
c = n % 10;
s = a + b + c;
std::cout << "The digits sum is:" << s;
return 0;
}