#include <iostream> int main() { int i,n,m; cout <<"Enter the total number\n"; cin >>n; cout <<"The total number of array is \n"<<n; for(i=1;i<=n;i++) cin >>a[i]; cout <<"the array is \n"; for(i=1;i<=n;i++) cout <<"\n"<<a[i];
m = a[1]; for(i=2;i<=n;i++) { if(m>a[i]) s = a[i]; } cout <<"smallest among 'n' number is \n"<< m; return 0; }
#include <iostream> int main() { int i,n,m; cout <<"Enter the total number \n"; cin >>n; cout <<"The total number of array is \n"<<n; for(i=1;i<=n;i++) cin >>a[i]; cout <<"The entered array is \n"; for(i=1;i<=n;i++) cout <<"\n"<<a[i]; m = a[1]; for(i=2;i<=n;i++) { if(m<a[i]) m = a[i]; } cout <<"The largest number is \n"<< m; return 0; }
#include <iostream> int main() { int i,n,sum; cout <<"Enter the total number \n"; cin >>n; cout <<"The total number of array is \n"<<n; for(i=1;i<=n;i++) cin >>a[i]; sum=0; cout <<"the array is \n"; for(i=1;i<=n;i++) cout <<"\n"<<a[i]; for(i=1;i<=n;i++) sum=sum+a[i]; cout <<"The sum of 'n' number is \n"<< sum; return 0; }
#include <iostream> int main() { int i,n,m; cout <<"Enter the total numbers \n"; cin >>n; cout <<"The total number of array is \n"<<n; for(i=1;i<=n;i++) cin >>a[i]; m=0; cout <<"The entered array is \n"; for(i=1;i<=n;i++) cout <<"\n"<<a[i]; for(i=1;i<=n;i++) m = m + a[i]; m = m / n; cout <<" The average of 'n' numbers is \n"<< m; return 0; }
#include <iostream> int main() { int p,q; cout <<"enter the number \n"; cin >>p; cout <<"the given number is \n"<<n; q=p%2; if(q==0) cout << p<<" is even number \n"; else cout <<p<<" is odd number \n"; return 0; }
#include <iostream> int main() { int n,m,p,q; cout <<"Enter the number\n"; cin >>n; cout << "Entered number is \n"<<n; m=n; p=0; do { q=n%10; n=n/10; p=p*10+q; } while(n!=0); if(p==m) cout <<"The given number is palindrome \n"<<m; else cout <<"The given number is not palindrome \n"<<m; return 0; }
#include <iostream> int main() { int l, i, j, k; clrscr(); l=0; cin >>n; for(i=1;i<=n;i++) { for(j=2;j<=(i-1);j++) { k=i%j; if (k==0) l=1; else l=l; } if (l==0) cout <<"The number is prime \n"<<i; else cout <<"This is not a prime number \n"<<i; l=0; } return 0; }
#include <iostream> int main() { int s, n, m, r; cout <<"Enter the number \n"; cin >>n; cout <<" Entered number is \n"<< n; s=0; m=n; do { r=n%10; n=n/10; s=s+r*r*r; }while (n!=0); if(s==m) cout <<"This is Armstrong number\n"; else cout <<"This is not Armstrong number\n"; return 0; }
#include <iostream> int main() { int x, i, j, n, m; cout <<"Enter the total number \n"; cin >>n; cout <<"Total number of the series is \n"<< n; i=0,j=1; cout <<i<<j; for(x=3;x<=n;x++) {m=i+j; cout <<"\n"<<m; i=j;j=m; } return 0; }
#include <iostream> int main() { int i,f,n; f=1; cout <<"Enter the number \n"; cin >>n; for(i=1;i<=n;i++) f=f*i; cout <<"Factorial of "<<n <<" is "<<f; return 0; }
#include <iostream> int main() { int r, n; cout <<"enter the number \n"; cin >>n; cout <<"reverse of the number is "; do { r=n%10; n=n/10; cout <<r; }while(n!=0); cout << "\n"; return 0; }
#include <iostream> int main() { int s,n,n1; cout <<"enter the number \n"; s=0; cin >>n; cout <<"the given number is \n"<<n; a: do { n1=n%10; s=s+n1; n=n/10; } while (n!=0); if(s>9) { n=s; s=0; goto a; } else cout <<"sum of digit is \n"<<s; return 0; }