C Program Question

C Program Question

How i can calulate sum of First digit and last digit of Five Numbers.
e.g 12345
i want to calculate 1+5=6
how i can calculate in C Program?

View Answers

January 22, 2010 at 4:56 PM

Hi Friend,

Try the following code:

#include <stdio.h>
#include <conio.h>
void main(){
int i;
int list[5];
int first,last;
int sum,num;
clrscr();
printf("Enter five digit number:");
for( i = 0; i <5;i++){
scanf("%d",&num);
list[i]=num;
}
first=list[0];
last=list[4];
sum=first+last;
printf("Sum of first and last number is: %d",sum);
getch();
}

Thanks









Related Tutorials/Questions & Answers:
C Program Question - Development process
C Program Question  How i can calulate sum of First digit and last digit of Five Numbers. e.g 12345 i want to calculate 1+5=6 how i can calculate in C Program?   Hi Friend, Try the following code
question for c++
question for c++   write Program to swap between two numbers if first number is greater than second number and total of two numbers greater than 10
Advertisements
C# question
Create a Solution by name Bank with Classes Account.cs, SavingsAccount.cs and savingsTest.cs to Demonstrate Abstract Classes in C#  1st question... and savingsTest.cs to Demonstrate Abstract Classes in C
C# question
C# question  Write a program in C# to create 3*4 matrix and show the sum of diagonal values
C# question
C# question  Write a program in C# to create 3*4 matrix and show the sum of diagonal values
question for c++
question for c++   write Program to swap between two numbers if first number is greater than second number and total of two numbers greater than 10   Ã?¨Ã?±Ã?â? Ã?§Ã?â?¦Ã?¬ Ã?â??Ã?â?¦Ã?¨Ã?§Ã?¯Ã?â??Ã?© Ã?¨Ã
C# question
C# question  Explain enumeration base types in C
C# question
C# question  In C#, string is a class or primitive type. Explain
C# question
C# question  How can we call method pass by reference in C
c question
c question  How to convert decimal numbers into binary digits without using pow function in c language
C/C++/JAVA Question on function
C/C++/JAVA Question on function  "Write a function to find out common... other data type also.ââ?¬Â? Question can be solved in C,C++ or JAVA. (Recommneded - C
C program
C program  hi, here is my question: Create a structure to specify data on students given below: Roll number, Name,Department, Course, Year... a function to print names of all students who joined in a particular year. (c
program of c
program of c  write a program in c to display a to z without using printf or scanf statements or header files
c++ program
c++ program  Write a program which reads a text from the keyboard and displays the following information on the screen in two columns: (a) Number of lines (b) Number of words (c) Number of characters Strings should be left
C Program
C Program  Why doesn't the code int a = 1000, b = 1000; long int c = a * b; work? plz help me sir
c program
c program  plz send me program for this. write a program to print the following code? (in c language) 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 2 3 4 5 6 7 8 9 10
c program
c program  How to convert binary digits to decimal number without using power function
c program
c program  WAP to show the area of a perimeter of a rectanglar by using input command
turbo C Question 6.
turbo C Question 6.  Explain call by value and call by reference with easy examples
c program
c program  plz send me program for this. write a program to print the following code? 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 2 3 4 5 6 7 8 9 10 11 12 3 4
C++ question 3
C++ question - add the two matrices and display the elements of resultant matrix.   Write a program to accept from user elements of two 2x3 matrices....   C sum of two matrices The given code allow the user to enter
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
turbo C Question 4.
turbo C Question 4.  Possible to print the following (Using for Loops): 1. * ** 2.* * ** * * * *   specify the format properly
program in c
program in c  Write a program that inputs five different integers from the keyboard, then print the sum, the product, the smallest and the largest of these numbers. Use only single selection form of if statement. For example: 1 3
turbo C Question 5.
turbo C Question 5.  is it possible to print "", 1st line (5 times),2nd line *(4 times),3rd line *(3 times),4th line *(2 times) & 5th line *(1 times) with Align Right. and also reverse order as 1,2,3,4,5 (but right aline
method overloading in c program
method overloading in c program  how is method overloading in C program is different from C++ program
malloc in c example program
malloc in c example program  What is malloc in c? Please explain the term using an example in C program. Thanks
C Program with Database Connectivity
C Program with Database Connectivity  How To Connect MySQL Database in C Program with Graphics
C program - SQL
C program  Write a C program for airport simulation using queue data structures. Please reply me
c program - Java Beginners
c program  Write a program to encrypt a string and decrypt
C++ Question 2
C++ Triangle and Rectangle - calculate area of Triangle and rectangle using data members from base class  2.create class. Shape accepts two values (Data Type: Double). Create two derived classes Triangle and Rectangle ; calculate
c program - IoC
c program  given the string "wordprocessing",write a program to read the string from the terminal and display the same in the following formats: a) word processing b) word processing c) w.p.
C program to print the following
C program to print the following  Hello, Some one help me with a "C Program" to print the following as output: 4444444 4333334..., that is why I choosed Java Beginners, but please give me a C program
C Program - Development process
C Program  C program to find division of two fraction number without...: #include #include #include int main () { int a; int b; int c; int... in the form a/b: "); scanf("%d/%d", &c, &d); nr=a*d; dr=b*c; printf("%d/%d",nr,dr
c program - Java Beginners
c program  1. How to write a program to Add 2 numbers without using int .size should be more than machine size
C program - Java Magazine
C program  develop a simple program in C that allows a user to enter... and then the program; a)First determines whether the 3 integers entered represent the sides..., the program should print the following; The three integers form a Right-angled
C program - SQL
C program  write a C program to print multiplication table using pointers.  Hi Friend, Try the following code: #include #include void main() { int i,j; int * pt; clrscr(); printf(" "); printf("\n
about a program in c language
about a program in c language   Write a program that inputs five different integers from the keyboard, then print the sum, the product, the smallest and the largest of these numbers. Use only single selection form of if statement
C program - SQL
C program  Thank You . Write some C programs using pointers . Write some C programs using files. Please reply me .   Hi Friend, Please visit the following link: http://www.roseindia.net/c
c++ program of inheritance
c++ program of inheritance   Assume that a bank maintains two kinds of accounts for customers, one called as savings account and the other as current.... (b) Display the balance (c) Compute and deposit interest. (d) Permit
C Programming SubString Program
C Programming SubString Program  Sir I want to Check whether the Single Substring is present in the given 3 string. characters. eg if i entered... entered to check PROGRAM is exists in given three strings then output
C Program....PLEASE HELP
C Program....PLEASE HELP  For this assignment, you are to write a program that calculates points along a rhodonea curve, a.k.a. a mathematical rose, and produces a simple character plot of the results, using functions, arrays
C++ program not running
C++ program not running  Hi, this program need to ask 10 random questions with a random month name. Example: RUN How many days are there in the month of March? 28 No March has 31 days. How many days are there in the month
C Program - Development process
C Program  How to do sum of Diagnol Matrix e.g 3 6 9 4 5 7 7 6 9 I want to display sum of 3+5+9 i.e to do sum of Diagnol Matrix plz Help Me  Hi Friend, Try the following code: #include #include
C program - SQL
C program  Thanks!!!!!!!!!! Please reply me some programs for DATA STRUCTURES (LINKED LISTS,ETC)  Hi Friend, Try the following code: # include # include #include struct element *temp; struct
simple program question
simple program question  how do i get a java program to take an input from the user and have it terminate by a period and not by pressing enter
Java program question ...
Java program to draw a triangle of stars given N the number of stars at the bottom line  Write a program to draw a triangle of stars given N the number of stars at the bottom line. can assume that N will always be an odd number
turbo c pre-increment question
turbo c pre-increment question  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
program code for this question - Java Beginners
program code for this question  QUESTION 2: Address Information... as an IP lookup tool. The program reads a search phrase (which could either be an IP... file. The program should display the IP address together with all the associated
Write a C/C++ program to show the result of a stored procedure
Write a C/C++ program to show the result of a stored procedure   how to write this?? Write a C/C++ program to show the result of a stored procedure "PROCRESETMAIL" on database "USER_NOTIFY

Ads