C++ CODING FOR BEGINNERS
hy steemers since vtwo hours ago i wrote a program in my compiler Dev c++,& these programe shar with you because i am learning c++ language .
*C++ Program (1) Reverse Any Number:
the coding of program is below:
#include <iostream.h>
using namespace std;
int main()
{
int n, reversedNumber = 0, remainder;
cout << "Enter an integer: ";
cin >> n;
while(n != 0)
{
remainder = n%10;
reversedNumber = reversedNumber*10 + remainder;
n /= 10;
}
cout << "Reversed Number = " << reversedNumber;
return 0;
}
C++ Program (2) Find Factorial of Number:
Here is the program:
#include<iostream.h>
main()
{
int num, i, fact=1;
cout<<"Enter a number : ";
cin>>num;
for(i=num; i>0; i--)
{
fact=fact*i;
}
cout<<"Factorial of "<<num<<" is "<<fact;
return 0;
}
C++ programe no is(3) Code to Check Vowel Alphabet or Not:
Here is the programe :
this programee is written in conditional operator
include<iostream.h>
main()
{
char ch;
cout<<"Enter an alphabet : ";
cin>>ch;
if(ch=='a' || ch=='A' || ch=='e' || ch=='E' ||
ch=='i' || ch=='I' || ch=='o' || ch=='O' ||
ch=='u' || ch=='U')
{
cout<<"This is a vowel";
}
else
{
cout<<"This is not a vowel";
}
return 0;
}
i hope you learn it .
i love coding & i am studying in BSSE .