-->
Friday, June 24, 2022
Add all the Even digits of a number | C Program
FindError
Home
Catagories
C Programs
C Graphics
Python Programs
About
contact
Home
About
Contact
C Programs
Swapping using 3rd variable
Swapping without using 3rd variable
Even or Odd check
Biggest among three numbers
Add all digits of a number
Add all Even digits of a number
Add all Odd digits of a number
Add all the Even digits of a number in c
Q. Write a C program to add all the Even digits of a number
Output
Source Code
// WAP to add all the even digits of a number // Code for TurboC++ compiler #include
#include
void main() { int num, r, even; clrscr(); printf("\nEnter any number:: "); scanf("%d",&num); even=0; while(num!=0) { r= num%10; if(r%2==0) even= even+r; num= num/10; } printf("Sum of even digits:: %d",even); getch(); }
Copy Code
// WAP to add all the even digits of a number // Code for DevC++ compiler #include
int main( ) { int num,r,even; printf("\nEnter any number:: "); scanf("%d",&num); even=0; while(num!=0) { r= num%10; if(r%2==0) even= even+r; num= num/10; } printf("Sum of even digits:: %d",even); return 0; }
Copy Code
C Programs
Swapping using 3rd variable
Swapping without using 3rd variable
Even or Odd check
Biggest among three numbers
Add all digits of a number
Add all Even digits of a number
Add all Odd digits of a number
No comments:
Post a Comment
Newer Post
Older Post
Home
Contact Form
Name
Email
*
Message
*
No comments:
Post a Comment