ACP1_8

#include<stdio.h> int digit(float,int); void main() { float num; //float to handle large numbers int pos; clrscr(); printf("\nEnter a number : "); scanf("%f",&num); printf("Enter position from right : "); scanf("%d",&pos); printf("\nNo. required : %d",digit(num,pos)); getch(); } int digit(float n,int p) { int a,temp; for(a=0;a<p;a++) { temp=(int)n%10; n=n/10; } return temp; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.