Posts

Showing posts from October, 2010

TO FIND WHETHER A NO. IS ARMSTRONG OR NOT IN C++

/* FOR EX. 153 = (1*1*1)+(5*5*5)+(3*3*3) */   # include <iostream.h> # include <conio.h> void main () {       clrscr();       int a,sum=0;       long int n,num;       cout<<"Enter the no. : ";       cin>>n;       num = n;       for(;n>0;)         {              a=n%10              sum=sum+(a*a*a);              n=n/10;         }       if(sum==num)          {                ...

Program to print asterisk(*) pattern in C++ #1

  Program to print an asterisk(*) pattern *            * **         ** ***      *** ****   **** ********** */   #include<iostream.h> #include<conio.h> void main() {     clrscr();     int i,j,k,l,m;     for(i=1;i<=5;i++)   {   cout<<"\n"; for(m=1;m<=i;m++)     {                 cout<<"*";     }            for(j=5;j>i;j—)             {                      cout<<" ";          ...