Decode School

Decode School - The School for Problem Solvers
Welcome to My Blog.
Need Assignment / Project Guidance (or) Training in Python?

C Program to find the first digit of a number

Sample Input 1 :

734

Sample Output 1 :

First digit is 7

Program or Solution

					    
							
#include<stdio.h>
int main()
{
	int n,num;
	scanf("%d",&num);
	n=num;
	while(num>=10)
	{
		num/=10;
	}
	printf("%d is the first digit in %d",num,n);
	return 0;
}
		
					    
					

Program Explanation

refer video tutorial