Translate

Ad-Horizontal

Search This Blog

Monday, 24 December 2018

How to write a C++ program (Turbo C++) to input a three digit number and display its digit/number at one's, ten's & hundred's place and calculate their sum and display it, without using any Loop.

We are gonna see how to write a C++ program (Turbo C++) to input a three digit number and display its digit/number at one's, ten's & hundred's place and calculate their sum and display it, without using any Loop.


The following codes have been run and compiled in C++(Turbo C++).

The writing in the right-hand side of this "//" in the codes are called comments of the code. They are not a necessary part of the codes and can be omitted in the codes. They are just mentioned so as to tell you the use/purpose of writing the left-hand side of the "//" or the codes.   In some special cases depending upon the Fond & Size of the text on your device the comments may entered the right hand-side of the "//"(next line) and come in between the main codes. so as to, make it easier for you to understand/distinguish the comments from the main codes; we have written the main code and comments in different sizes.
Example: Main codes: "  #include<iostream.h>  "
                 Comments: "   //It is a header file and used to call the input-output classes(Pre-defined library in C++).  " .


The Variables are user initialized with zero, so that they won't store any garbage value and hamper the final output of the program.

For more accurate result, users may replace "int" and "float" with "long" and "double" respectively.




The code are as follows:


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long num=0,unit=0,ten=0,hundred=0,sum=0;
cout<<"Enter the number which to be checked:"<<"\n":
cin>>num;
unit=num%10;
ten=(num/10)%10;
hundred=num/100;
sum=hundred+ten+unit;
cout<<"Number = "<<num<<"\n";
cout<<"Unit's Place = "<<unit<<"\n";
cout<<"Ten's Place = "<<ten<<"\n";
cout<<"Hundred's Place = "<<"\n";
cout<<"Sum of the digits of "<<num<<" = "<<sum<<"\n";
getch();
}


Program:




Code









Output:




Result













Result










Hope that the Blog have helped you in your work. 


Do visit again to see more Coding related blogs.

How to write a C++ program (Turbo C++) to input a three digit number and display its digit/number at one's, ten's & hundred's place and display the reverse of the number, without using any Loop.

We are gonna see how to write a C++ program (Turbo C++) to input a three digit number and display its digit/number at one's, ten's & hundred's place and display the reverse of the number, without using any Loop.


The following codes have been run and compiled in C++(Turbo C++).

The writing in the right-hand side of this "//" in the codes are called comments of the code. They are not a necessary part of the codes and can be omitted in the codes. They are just mentioned so as to tell you the use/purpose of writing the left-hand side of the "//" or the codes.   In some special cases depending upon the Fond & Size of the text on your device the comments may entered the right hand-side of the "//"(next line) and come in between the main codes. so as to, make it easier for you to understand/distinguish the comments from the main codes; we have written the main code and comments in different sizes.
Example: Main codes: "  #include<iostream.h>  "
                 Comments: "   //It is a header file and used to call the input-output classes(Pre-defined library in C++).  " .


The Variables are user initialized with zero, so that they won't store any garbage value and hamper the final output of the program.

For more accurate result, users may replace "int" and "float" with "long" and "double" respectively.




The code are as follows:


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long num=0,unit=0,ten=0,hundred=0,rev=0;
cout<<"Enter the number which to be checked:"<<"\n":
cin>>num;
unit=num%10;
ten=(num/10)%10;
hundred=num/100;
rev=(unit*100)+(ten*10)+(hundred*1);
cout<<"Number = "<<num<<"\n";
cout<<"Unit's Place = "<<unit<<"\n";
cout<<"Ten's Place = "<<ten<<"\n";
cout<<"Hundred's Place = "<<"\n";
cout<<"Reverse of the number,"<<num<<" = "<<rev<<"\n";
getch();
}


Program:




Code










Output:


Result



Result












Hope that  the Blog have helped you in your work. 


Do visit again to see more Coding related blogs.

How to write a C++ program (Turbo C++) to input Dividend and Divisor and find out and display the Quotient and Remainder.

We are gonna see how to write a C++ program (Turbo C++) to input Dividend & Divisor and find out & display the Quotient & Remainder.


The following codes have been run and compiled in C++(Turbo C++).

The writing in the right-hand side of this "//" in the codes are called comments of the code. They are not a necessary part of the codes and can be omitted in the codes. They are just mentioned so as to tell you the use/purpose of writing the left-hand side of the "//" or the codes.   In some special cases depending upon the Fond & Size of the text on your device the comments may entered the right hand-side of the "//"(next line) and come in between the main codes. so as to, make it easier for you to understand/distinguish the comments from the main codes; we have written the main code and comments in different sizes.
Example: Main codes: "  #include<iostream.h>  "
                 Comments: "   //It is a header file and used to call the input-output classes(Pre-defined library in C++).  " .


The Variables are user initialized with zero, so that they won't store any garbage value and hamper the final output of the program.

For more accurate result, users may replace "int" and "float" with "long" and "double" respectively.




The code are as follows:


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long divident=0,divisor=0,quotient=0,remainder=0;
cout<<"Enter the Dividend:"<<"\n";
cin>>dividend;
cout<<"Enter the Divisor:"<<"\n":
cin>>divisor;
quotient=dividend/divisor;
remainder=dividend%divisor;
cout<<"Dividend = "<<dividend<<"\n";
cout<<"Divisor = "<<divisor<<"\n";
cout<<"Quotient = "<<quotient<<"\n";
cout<<"Remainder = "<<remainder<<"\n";
getch();
}


Program:



Code






Output:




Result



Result









Hope that  the Blog have helped you in your work. 


Do visit again to see more Coding related blogs.

Saturday, 8 December 2018

How to write a C++ program (Turbo C++) to input the Principal Amount, Simple Interest, Rate of Interest and calculate and display the Time Period and final Amount.

We are gonna see how to write a C++ program (Turbo C++) to input the Principal Amount, Simple Interest, Rate of Interest and calculate and display the Time Period and final Amount.


The following codes have been run and compiled in C++(Turbo C++).

The writing in the right-hand side of this "//" in the codes are called comments of the code. They are not a necessary part of the codes and can be omitted in the codes. They are just mentioned so as to tell you the use/purpose of writing the left-hand side of the "//" or the codes.   In some special cases depending upon the Fond & Size of the text on your device the comments may entered the right hand-side of the "//"(next line) and come in between the main codes. so as to, make it easier for you to understand/distinguish the comments from the main codes; we have written the main code and comments in different sizes.
Example: Main codes: "  #include<iostream.h>  "
                 Comments: "   //It is a header file and used to call the input-output classes(Pre-defined library in C++).  " .


The Variables are user initialized with zero, so that they won't store any garbage value and hamper the final output of the program.

For more accurate result, users may replace "int" and "float" with "long" and "double" respectively.




The code are as follows:


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double p=0,r=0,t=0,si=0,a=0;
cout<<"Enter the Principal Amount Rs :"<<"\n";
cin>>p;
cout<<"Enter the Rate of Interest:"<<"\n";
cin>>r;
cout<<"Enter the Simple Interest Rs :"<<"\n";
cin>>si;
t=(si*100)/(p*r);
a=si+p;
cout<<"The Time Period in Years =  "<<t<<"\n";
cout<<"The Amount = Rs "<<a<<"\n";
getch();
}


Program:



Code










Output:



Result










Hope that  the Blog have helped you in your work. 


Do visit again to see more Coding related blogs.

How to write a C++ program (Turbo C++) to input the Principal Amount, Simple Interest, Time Period and calculate and display the Rate of Interest and final Amount.

We are gonna see how to write a C++ program (Turbo C++) to input the Principal Amount, Simple Interest, Time Period and calculate and display the Rate of Interest and final Amount.


The following codes have been run and compiled in C++(Turbo C++).

The writing in the right-hand side of this "//" in the codes are called comments of the code. They are not a necessary part of the codes and can be omitted in the codes. They are just mentioned so as to tell you the use/purpose of writing the left-hand side of the "//" or the codes.   In some special cases depending upon the Fond & Size of the text on your device the comments may entered the right hand-side of the "//"(next line) and come in between the main codes. so as to, make it easier for you to understand/distinguish the comments from the main codes; we have written the main code and comments in different sizes.
Example: Main codes: "  #include<iostream.h>  "
                 Comments: "   //It is a header file and used to call the input-output classes(Pre-defined library in C++).  " .


The Variables are user initialized with zero, so that they won't store any garbage value and hamper the final output of the program.

For more accurate result, users may replace "int" and "float" with "long" and "double" respectively.




The code are as follows:


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double p=0,r=0,t=0,si=0,a=0;
cout<<"Enter the Principal Amount Rs :"<<"\n";
cin>>p;
cout<<"Enter the Simple Interest Rs :"<<"\n";
cin>>si;
cout<<"Enter the Time Period in Years:"<<"\n";
cin>>t;
r=(si*100)/(p*t);
a=si+p;
cout<<"The Rate of Interest = "<<si<<"%"<<"\n";
cout<<"The Amount = Rs "<<a<<"\n";
getch();
}


Program:




Code












Output:


Result











Hope that  the Blog have helped you in your work. 


Do visit again to see more Coding related blogs.

How to write a C++ program (Turbo C++) to input the Principal Amount, Rate of Interest, Time Period and calculate and display the Simple Interest and final Amount.

We are gonna see how to write a C++ program (Turbo C++) to input the Principal Amount, Rate of Interest, Time Period and calculate and display the Simple Interest and final Amount.


The following codes have been run and compiled in C++(Turbo C++).

The writing in the right-hand side of this "//" in the codes are called comments of the code. They are not a necessary part of the codes and can be omitted in the codes. They are just mentioned so as to tell you the use/purpose of writing the left-hand side of the "//" or the codes.   In some special cases depending upon the Fond & Size of the text on your device the comments may entered the right hand-side of the "//"(next line) and come in between the main codes. so as to, make it easier for you to understand/distinguish the comments from the main codes; we have written the main code and comments in different sizes.
Example: Main codes: "  #include<iostream.h>  "
                 Comments: "   //It is a header file and used to call the input-output classes(Pre-defined library in C++).  " .


The Variables are user initialized with zero, so that they won't store any garbage value and hamper the final output of the program.

For more accurate result, users may replace "int" and "float" with "long" and "double" respectively.




The code are as follows:


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double p=0,r=0,t=0,si=0,a=0;
cout<<"Enter the Principal Amount Rs :"<<"\n";
cin>>p;
cout<<"Enter the Rate of Interest:"<<"\n";
cin>>r;
cout<<"Enter the Time Period in Years:"<<"\n";
cin>>t;
si=(p*t*r)/100;
a=si+p;
cout<<"The Simple Interest = Rs "<<si<<"\n";
cout<<"The Amount = Rs "<<a<<"\n";
getch();
}


Program:





Code








Output:


Result








Hope that  the Blog have helped you in your work. 


Do visit again to see more Coding related blogs.