Program to add digits of a number in C
#include <stdio.h> int main() { int n, sum = 0, remainder; printf(“Enter an integern”); scanf(“%d”,&n); while(n != 0) { remainder = n % 10; sum = sum + remainder; n … Read More
#include <stdio.h> int main() { int n, sum = 0, remainder; printf(“Enter an integern”); scanf(“%d”,&n); while(n != 0) { remainder = n % 10; sum = sum + remainder; n … Read More
#include <stdio.h> int main() { int i,j,rows; printf(“Enter the number of rows: “); scanf(“%d”,&rows); for(i=rows;i>=1;–i) { for(j=1;j<=i;++j) { printf(“* “); } printf(“n”); } return 0; } Output * * * … Read More
#include <stdio.h> int main() { int i,j,rows; printf(“Enter the number of rows: “); scanf(“%d”,&rows); for(i=1;i<=rows;++i) { for(j=1;j<=i;++j) { printf(“* “); } printf(“n”); } return 0; } Output * * * … Read More
#include stdio.h using namespace std; int main() { int range, first = 0, second = 1, fibonicci=0; cout << “Enter Range for Terms … Read More
#include stdio.h int main() { int num, i = 1; printf(“n Enter any Number:”); scanf(“%d”, &num); printf(“Multiplication table of %d: n”, num); while … Read More
#include iostream.h #include conio.h void main() {clrscr(); int a,b,c,d=0; cout<<“Enter number:”; cin>>a; b=a; do
#include stdio.h int main() { int a, b, x, y, t, gcd, lcm; printf(“Enter two integersn”); scanf(“%d%d”, &x, &y); a = x; b = y; … Read More
#include stdio.h int main() { int n, i, c, a = 1; printf(“Enter the number of rows of Floyd’s triangle to printn”); scanf(“%d”, &n);