Computer Science, asked by MasterQuestioner, 1 year ago

Write a program to initialize an
int variable a with 76498 and from it extract the
first digit and store it in f and extract the last
digit in l and display both these digits.
Class 9 - Computer Applications - Ch 3

Answers

Answered by duragpalsingh
39

Hey there!

Answer:

public   class Question

{     static void main()  

  {  

       int a=76498,f,l;    

     f=a/10000;    

    l=a%10;      

  System.out.println("First digit="+f);    

     System.out.println("Last digit="+l);    

} }

Hope It helps You!

Answered by Anonymous
17

int a=76498,

f,l; f=a/10000;

l=a%10;

System.out.println

("First digit="+f);

System.out.println

("Last digit="+l);

Similar questions