#include<stdio.h>
#include<conio.h>
main( )
{
int x,y,z,w;
clrscr( );
printf ("Enter a two digit number :");
scanf ("%d", &x);
y=x/10;
z=x%10;
w=y+z;
printf ("sum of individual digits of given numbers %d",w);
getch( );
}
Explanation:
Two digit number is 37
y=37/10; means 37/10, we get 3
z=37%10;means we get remainder value i.e. z=7
w=3+7
Sum is 10
Output:
Run-1
Run-2
Previous Next
#include<conio.h>
main( )
{
int x,y,z,w;
clrscr( );
printf ("Enter a two digit number :");
scanf ("%d", &x);
y=x/10;
z=x%10;
w=y+z;
printf ("sum of individual digits of given numbers %d",w);
getch( );
}
Explanation:
Two digit number is 37
y=37/10; means 37/10, we get 3
z=37%10;means we get remainder value i.e. z=7
w=3+7
Sum is 10
Output:
Run-1
Run-2
Previous Next
No comments:
Post a Comment