ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
If 4 digits number is input through the keyboard, Write a 
program to calculate sum of its 1st & 4th digit.
 Question Submitted By :: Ydw_10
I also faced this Question!!     Rank Answer Posted By  
 
  Re: If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
Answer
# 1
#
#
void main()
{
int num,n1,n2,sum;
cout<<"enter a 4 digit no.";
cin>>num;
n1=num/1000;
n2=num%10;
sum=n1+n2;
cout<<"sum of 1st & 4th digit is"<<sum;
}
 
Is This Answer Correct ?    15 Yes 4 No
Bharghavi
 
  Re: If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
Answer
# 2
#include<stdio.h>
main()
{
int n,n1,n4;
printf("Enter 4 digit number:");
scanf("%d",&n);
n4=n%10;
n1=n/100;
printf("\nResult=",(n1+n4));
getch();
}

 
Is This Answer Correct ?    10 Yes 9 No
Anvesh
 
 
 
  Re: If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
Answer
# 3
thiz z how 2 find the sum of first and last digit of any 
number

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
long int n,nf,nl,temp;
int count=-1;
printf("Enter a number:");
scanf("%ld",&n);
temp =n;
while(temp<0)
{
  temp=temp/10;
c++;
}
nl=n%10;
nf=n/(pow(10,c));
printf("\n%ldResult=",(nf+nl));
getch();
}
 
Is This Answer Correct ?    3 Yes 4 No
Kadher Masthan ,...sit
 
  Re: If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
Answer
# 4
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num,n1,n2,sum;
clrscr();
printf("Enter 4 digit number:");
scanf("%d",&num);
n1=num/1000;
n2=num%10;
sum=n1+n2;
printf("Sum of 1st & 4th digit number is=%d",sum);
getch();
}
enjoy!!!!!!!!!!!!

any program just mail me:
ssmartinp@gmail.com
 
Is This Answer Correct ?    4 Yes 1 No
Sourav Sinha
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Suppose I want to write a function that takes a generic pointer as an argument and I want to simulate passing it by reference. Can I give the formal parameter type void **, and do something like this? void f(void **); double *dp; f((void **)&dp);  1
program to find the second largest word in a paragraph amongst all words that repeat more thn twice iGate3
can you explain in brief what is "r+" mode in a file... i know that it si used to read and modify rhe existing content.... but explalanation about the file pointer in "r+" mode i wann to know??????????? Cognizent1
What character terminates all strings composed of character arrays? 1) 0 2) . 3) END  3
let's take a code struct FAQ { int a; char b; float c; double d; int a[10]; }*temp; now explain me how the memory will be allocated for the structure FAQ and what address will be in the structure pointer (temp)....................  7
write a function to find whether a string is palindrome or not and how many palindrome this string contain?  1
suppose we use switch statement and we intilize years name using enum statement like(jan,feb,mar,------dec) we take integer value as an input .question is that the month which we analyz is from 0 to 11 bt if i enter 12 than how he again starts from begning and print jan  1
hat is a pointer? Assurgent3
How can I allocate arrays or structures bigger than 64K?  4
If we have an array of Interger values, find out a sub array which has a maximum value of the array and start and end positions of the array..The sub array must be contiguious. Take the start add to be 4000. For Ex if we have an array arr[] = {-1,-2,-5,9,4,3,-6,8,7,6,5,-3} here the sub array of max would be {8,7,6,5} coz the sum of max contiguous array is 8+7+6+5 = 26.The start and end position is 4014(8) and 4020(5). Microsoft4
What is the difference between typeof(foo) and myFoo.GetType()?  1
what is the code for getting the output as * ** *** Caritor5
What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); } ADITI5
Convert the following expression to postfix and prefix (A+B) * (D-C) Satyam2
what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means.... TCS1
Is reference used in C?  1
What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); } ADITI14
What is alloca() and why is its use discouraged?  1
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.  1
how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk. Google3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com