DFD

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

zxczxvzfgrdfgdrfgergerxcsccdcd

L.C.M of Two Numbers:

#include <iostream>

#include<iomanip>

#include<conio.h>

#include<string>

using namespace std;

int main()

{ int a, b;

cout <<"Enter first number: ";


cin >> a;

cout << "Enter second number: ";

cin >> b;

int c=min(a , b);

int GCD=1;

int i=1;

while (i<=c)

{i++;

if (a%i==0 && b&i==0)

GCD = max(GCD , i);}

int LCM = (a*b)/GCD;

cout << "LCM of two numbers is: " << LCM << endl;

system ("pause");

-----------------------------------------------------------------------------------

G.C.D of Two Numbers:

#include <iostream>

using namespace std;

int main()

{ int a, b;

cout << “Enter first number: “;

cin >> a;

cout << “Enter second number: “;


cin >> b;

int min(a,b);

int GCD=1;

int i=1;

while (i<=c)

{i++;

if (a%i==0 && b&i==0)

GCD = max(GCD , i);}

cout << “G.C.D of Two Numbers is : “ << GCD << endl;

system (“pause”);

return 0;

----------------------------------------------------------------------------------

Palindrome Number:

#include <iostream>

using namespace std;

int main()

int palindrome, reverse=0, num=0, check;

cout << “Enter a Number: “;

cin >> palindrome;

check = palindrome;
int i=1;

while (palindrome =0)

i++;

num = palindrome %10;

palindrome = palindrome /10;

reverse = num + (reverse * 10 );

If (reverse == check )

cout << “Number is Palindrome.” << endl ;

else cout << “Number is not Palindrome.” << endl ;

system (“pause”) ;

return 0;

-----------------------------------------------------

Armstrong Number:

#include <iostream>

using namespace std;

int main()

{ int armstrong , num=0 ,result=0, check;

cout << "Enter a number: ";

cin >> armstrong;

check = armstrong;
int i=1;

while (armstrong !=0)

i++;

num = armstrong %10;

armstrong = armstrong/10;

result=result+(num*num*num);

if (result==check)

cout << "Number is armstrong." << endl ;

else cout << "Number is not armstrong." << endl;

system ("pause");

return 0;

----------------------------------------------

Fabonacci Series:

#include <iostream>

using namespace std;

int main()

{int members,first=0,second=1,third;

cout << "Enter number of members of series: ";

cin >> members;

int i=0;
while (i<members-1)

i++;

if ( i==0)

cout << first <<"," <<second ;

else {third=first+second;

first=second;

second=third;

cout << "," << third ;

cout << endl;

system ("pause");

return 0;

----------------------------------------------

Prime Number:

#include <iostream>

using namespace std;

int main()

{int number , count =0;

cout << "Enter a number: ";

cin >> number;

int i=1;
while (i<=number)

i++;

if (number%i==0)

count++;}

if (count==2)

cout << "Number is prime.";

else cout << "Number is not prime." << endl;

system ("pause");

return 0;

You might also like