TELEPHONE NO. PROGRAM;

QUESTION –

Write a program that enters a 10-digit telephone number (the first three digits refer to the area code, the next three digits refer to the exchange code, and the remaining four digits refer to number), prints the parts of the number and complete telephone number and addition of area code and exchange code.

ANSWER-

#include
#include
int main()
{
long int cont,add;
long int area;
long int ex;
long int exchange;
long int tel_no;
printf("\nCONTACT NO.:");
scanf("%ld",&cont);
area=cont/10000000;
ex=cont/10000;
exchange=ex%1000;
tel_no=cont%10000;
add=area+exchange;
printf("\nAREA CODE - EXCHANGE CODE - TELEFONE NO.");
printf("\n%ld - %ld - %ld",area,exchange,tel_no);
printf("\n\nADDITION OF AREA + EXCHANGE=%ld",add);
printf("\n\tPROGRAMMING @ CODE STUDIO");
getch();
}

OUTPUT-

call