#include <stdio.h>
int main(void)
{
int num, n, cube, d, sum;
printf("armstorng numbers are :\n");
for (num = 100; num <= 999; num++)
{
n = num;
sum = 0;
while (n > 0)
{
d = n % 10;
n /= 10;
cube = d * d * d;
sum = sum + cube;
}
if (num == sum)
printf("%d\n", num);
}
return 0;
}
let a = ['Apple', 'Mango', 'Banana', 'Orange', 'Pomegranate'];
let b = a.filter(a => a.length > 5);
console.log(b);
Output
[ 'Banana', 'Orange', 'Pomegranate' ]
Program to use JavaScript Array filter() method
let c = ['Apple', 'Mango', 'Banana', 'Orange', 'Pomegranate'];
let d = ['Orange', 'Apple', 'Banana']
let e = (c, d) => {
let value = [...c, ...d];
return value.filter((el) => {
return !(c.includes(el) && d.includes(el));
});
};
console.log(e(c, d));
Output
[ 'Mango', 'Pomegranate' ]
Program to use JavaScript Array filter() method
let f = [1, 2, 3, 4];
let g = [2, 1, 8, 3];
let h = (f, g) => {
let value = [...f, ...g];
return value.filter((el) => {
return !(f.includes(el) && g.includes(el));
});
};
console.log(h(f, g));
#include
int main(viod)
{
int i, j;
for (i = 1; i <= 3; i++)
{
printf("i=%d\n", i);
for (j = 1; j <= 4; j++)
{
printf("j=%d\t", j);
}
printf("\n");
}
return 0;
}
Program to use sum of digits of any number for loop in C Language
#include <stdio.h>
int main()
{
int n, sum = 0, rem;
printf("enter a number : ");
scanf("%d", &n);
for (; n > 0; n /= 10)
{
rem = n % 10;
sum += rem;
}
printf("sum of digits=%d\n", sum);
return 0;
}