//Writee a program that inputs a3 digit number finds the sumof these digits
#include <iostream.h>
#include <conio.h>
#include <math.h>
int main()
{
	int num,num1,num2,num3,num4,s=0;
	cout<<"Enter the Number: ";
	cin>>num;
	num1=num%10;
	num2=num/10;
	num3=num2%10;
	num4=num2/10;
	s=num1+num3+num4;
	cout<<"The sum of digits= ";
	cout<<s;
		 getch();
		 return0
}

This program I wrote but shows error in turboc++(4.5) it shows error I tried my best to correct but failed can you help me

Recommended Answers

All 2 Replies

Gee, if we had some idea what the error was we might be able to help.

> return0
Maybe it's the lack of a space and a ;
Like return 0;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.