• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Assignment no 5
 

Assignment no 5

on

  • 607 views

c++ assignment

c++ assignment

Statistics

Views

Total Views
607
Views on SlideShare
607
Embed Views
0

Actions

Likes
1
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Assignment no 5 Assignment no 5 Document Transcript

    • Assignment no 5 1) WAP to find the factorial value of any no. entered through the keyboard.flowchart:
    • Program://c++ program to find the factorial value#include<iostream.h>#include<conio.h>void main( ){clrscr( );int a,f=1;cout<<”Enter any number:”<<endl;cin>>a;for( int i=1; i<=a; i++){f=f*i;}cout<<”Factorial of the entered number=”<<f;getch();}
    • output:Enter any number:5Factorial of the entered number= 120 2) WAP to reverse any given integer no.
    • Program://c++ program to reverse the entered no#include<iostream.h>#include<conio.h>void main( ){clrscr( );int r,n,a=0;cout<<”Enter any three digit number:”<<endl;cin>>n;cout<<”Reverse of the entered number is:”<<endl;while(n!=0){r=n%10;
    • a=a*10+r;n=n/10;cout<<r;}getch();}Output:Enter any three digit number:123Reverse of the entered number is:321 3) WAP to check whether the given no is prime or not..
    • Program://c++ program to check whether the given no is prime or not
    • #include<iostream.h>#include<conio.h>void main( ){clrscr( );int a,c=0;cout<<”Enter any number:”<<endl;cin>>a;for( int i=1;i<=a;i++){if(a%1==0){c++;}}if(c==2){cout<<”Entered number is prime”<<endl;}
    • else{cout<<”Entered number is not prime”<<endl;}getch();}OutputEnter any number:5Entered number is prime