Month: April 2022

Write a C program, which takes two integer operands and one operator form the user performs the operation and then prints the result.

Write a C program, which takes two integer operands and one operator form the user performs the operation and then prints the result.

2. Write a C program, which takes two integer operands and one operator form the user performs the operation and then prints the result.(Consider the operators +,-,*, /, % and use Switch Statement). #include<stdio.h> #include<stdlib.h> int main() { int a,b,res,ch; printf(“\t *********************”); printf(“\n\tMENU\n”); printf(“\t********************”); printf(“\n\t(1)ADDITION”); printf(“\n\t(2)SUBTRACTION”); printf(“\n\t(3)MULTIPLICATION”); printf(“\n\t(4)DIVISION”); printf(“\n\t(5)REMAINDER”); printf(“\n\t(0)EXIT”); printf(“\n\t********************”); printf(“\n\n\tEnter your choice:”); scanf(“%d”,&ch); …

Write a C program, which takes two integer operands and one operator form the user performs the operation and then prints the result. Read More »

Write a C program to find the sum of individual digits of a positive integer

Write a C Program to find the sum of individual digits of a positive integer.

1. Write a C program to find the sum of individual digits of a positive integer. #include int main() { int num, k=1, sum=0; printf(“Enter the number whose digits are to be added:\n”); scanf(“%d”,&num); while(num!=0) { k=num%10; sum=sum+k; k=num/10; num=k; } printf(“Sum of the digits : %d”, sum); return 0; }