Data-Structure Mid-Square Method (Even Position)















Data-Structure Mid-Square Method
------------------------------------------------
------------------------------------------------
Sample Input: 1234
Sample Output: 525

#include<stdio.h>
void main()
{
    long int x,i,c=0,a[10],y;
    printf("Give the key value:");
    scanf("%d",&x);
    x=x*x;
    y=x;
    while(x!=0)
    {
        x/=10;
        c++;
    }
    for(i=c;i>=1;i--)
    {
        a[i]=y%10;
        y=y/10;
    }
    printf("The index number is:");
    for(i=2;i<=c;i=i+2)
    {
        printf("%ld",a[i]);
    }
}


(By:shahimtiyaj)
SHARE

Shah Imtiyaj

Try to know thyself

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

একটি মন্তব্য পোস্ট করুন