Professional Documents
Culture Documents
operator */
#include <stdio.h>
#define INT_SIZE sizeof(int) * 8 /* Bits required to represent an integer */
int main()
{
int num, count, i;
count = 0;
break;
}
count++;
}
return 0;
}
***********************************************************************************
*************************
/* program to check if the given number is armstrong or not by inputing any digit
number */
#include <stdio.h>
int main()
{
int num,r,sum=0,temp;
for(temp=num;num!=0;num=num/10)
{
r=num % 10;
sum=sum+(r*r*r);
}
if(sum==temp)
printf("%d is an Armstrong number.\n",temp);
else
printf("%d is not an Armstrong number.\n",temp);
}
***********************************************************************************
*************************
#include <iostream>
using namespace std;
int main() {
long n, d, r, binary = 0;
n=10;
d = n;
int temp = 1;
while (n!=0) {
r = n%2;
n = n / 2;
binary = binary + r*temp;
temp = temp * 10;
}
printf("%ld", binary);
return 0;
}
***********************************************************************************
**************************************
#include <stdio.h>
int main()
{
int n, i, c = 0;
printf("Enter any number n:");
scanf("%d", &n);
if (c == 2)
{
printf("n is a Prime number");
}
else
{
printf("n is not a Prime number");
}
return 0;
}
***********************************************************************************
************************************