Note: Armstrong numbers are those numbers if we take cube of their digits individually and add them then it will equal to the number.
e.g: 153
1^3 + 5^3 + 3^3 = 153
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int remainder, temp, sum=0, num, i;
cout << "Enter a number: ";
cin >> i;
num = temp = i;
while(temp != 0)
{
remainder = temp%10;
sum = sum + remainder*remainder*remainder;
temp = temp/10;
}
if(num == sum)
cout << "Number is Armstrong." <<endl;
else
cout << "Number is not Armstrong." <<endl;
getch();
}
Write a program to find given given number is armstrong or not?
Tuesday, 1 July 2014
Labels:
C++,
C++ Language,
Loops (For While Do-While)
Write a program in c language to find minimum number from array
#include <stdio.h>
#include <conio.h>
int main()
{
int array[100], min, size, c, location = 1;
printf("How many elements you want to enter in array: ");
scanf("%d",&size);
printf("Enter %d integers: ", size);
for ( c = 0 ; c < size ; c++ )
scanf("%d", &array[c]);
min = array[0];
for ( c = 1 ; c < size ; c++ )
{
if ( array[c] < min )
{
min = array[c];
location = c+1;
}
}
printf("Minimum element is located at location %d and value is %d: ", location, min);
getch();
}
#include <conio.h>
int main()
{
int array[100], min, size, c, location = 1;
printf("How many elements you want to enter in array: ");
scanf("%d",&size);
printf("Enter %d integers: ", size);
for ( c = 0 ; c < size ; c++ )
scanf("%d", &array[c]);
min = array[0];
for ( c = 1 ; c < size ; c++ )
{
if ( array[c] < min )
{
min = array[c];
location = c+1;
}
}
printf("Minimum element is located at location %d and value is %d: ", location, min);
getch();
}
Write a program in assembly language to get ASCII and convert it into Character.
Saturday, 14 June 2014
Tags: convert ascii into character in assembly language, assembly program to convert ascii into character
Note: This program is compiled in EMU software. Click Here to Download
Note: This program is compiled in EMU software. Click Here to Download
Labels:
Assembly Language
Write a program in assembly language to multiply matrices of 3x3 [Updated]
Tags: Multiplication is assembly language, multiplication of matrices in assembly language,
Note: This program is compiled in EMU software. Click Here to Download
Note: This program is compiled in EMU software. Click Here to Download
Labels:
Assembly Language
Subscribe to:
Posts (Atom)