Wednesday, 6 April 2016

C Program To Check Number Is Divisible By 11 Or Not Using (VEDIC MATH)

Problem :- Write A C Program To Check Number Is Divisible By 11 Or Not Using (VEDIC MATH)

Logic :- 
Here Is A Clarification Of  Below Program If We Want To Check Any No Is Divisible By 11 Or Not Its Very Simple You Have To Calculate Even And Odd Place Sum If Both Are Shame The No Also Will Be Divisible By 11 If Not Equal Then NOT Divisible By Now Check Code

Example :-

So take a Example 161051

So Add Even place and odd Place Numbers 

Even :- 6+0+1=7

Odd :- 1+1+5=7

Now Compare Even Or Odd Number addition If Both Are Equal then Number is Divisible Else Not .

If you got a Solution then Try Below Problems .

Try Yourself C Program For Denomination of an Amount Using While Loop

Solution :

#include<stdio.h>
#include<conio.h>
void main()
{
  //Ghanendra yadav
    long int r=0,i=1,odd=0,even=0,no,n,rev=0;
 
  while(1)
  {
    printf("\n\nEnter Any Number : ");
    scanf("%ld",&n);
    
no=n;

    while(no!=0)
    {
         
        r=no%10;
        rev=rev*10+r;
        no=no/10;
    }

    while(rev!=0)
    {
        r=rev%10;
        if(i%2==0)
        {
        even=even+r;
        }
        else
        {
            odd=odd+r;
        }
        rev=rev/10;
        i++;
    }

    printf("\nOdd Digit sum = %ld \n ",odd);
    printf("\nEven Digit Sum = %ld \n ",even);

    if(odd==even)
    printf("\n%ld Is Divisible by 11\n\n",n);
    else
    printf("\n%ld Is Not Divisible by 11\n\n",n);
}
    getch();

}

Output:-

C Program To Check Number Is Divisible By 11 Or Not Using (VEDIC MATH)

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment