Blogger templates

Pages

Thursday, 24 May 2012

Write a C Program to Find The Middle Digit of a Three Digit Number

Middle Digit

Statement of C Program: Input a Three Digit number and find out its Middle Digit: 

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf(" Enter a Three Digit Number:");
scanf("%d" ,&a);
b = (a / 10) % 10 ;
prinf("Middle digit=%d\n" ,b);
getch();
}

Output:
Enter a Three Digit Number:
123
Middle digit = 2

0 comments:

Post a Comment