First and Last Odd Digit

C CODE:

#include<stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
int n,i,j,k,l,t;
scanf("%d",&n);
int a[n],b[n];
for(i=0;i<n;i++)
{
    scanf("%d ",&a[i]);
}
for(i=0;i<n;i++)
{
    if(a[i]%2!=0)
    {
        t=(int)log10(a[i]);
        b[i]=(a[i]/pow(10,t));
        if(b[i]%2!=0)
        printf("%d ",a[i]);

    }
}
}

Comments

Popular posts from this blog

Reverse String Till Underscore

Count of common characters in two strings

RECTANGULAR SUM