Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process about a program in c language

Have Programming Question? Ask it here!
 
 
 


patchi maher
about a program in c language
1 Answer(s)      3 years and 4 months ago
Posted in : Development process


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 2 7 4 6 Sum is: 23 Average is: 4.5 Smallest: 1 Largest 7


Advertisement
View Answers

March 31, 2011 at 5:16 PM


    #include <stdio.h>
    #include <conio.h>

    int main(void){
      int num = 0;
      int sum = 0;
      int counter = 0;
      int min=0;
      int max=0;
      int temp;
      int product=1;
      while(counter < 5){
      printf("Enter number: ");
      if(scanf("%d", &num) == 1){
      if(num>=max){
         max=num;
      }
      if(num<=temp){
         min=num;
      }
      temp=num;
      sum += num;
      product*=num;
    }
    else{
      fprintf(stderr, "Error!");
      return 0;
    }
    counter++;
  }
  printf("Sum of numbers entered: %d\n", sum);
  printf("Product of numbers entered: %d\n", product);
  printf("The largest number is :%d\n",max);
  printf("The smallest number is :%d",min);

  return 0;
}


Related Tutorials/Questions & Answers:
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
write a program to use for loop print **********========== in c language
write a program to use for loop print **********========== in c language  write a program to use for loop print **========== in c language
Advertisements
C Language
C Language  What's the right declaration for main()? Is void main() correct? in C language ? please help me sir ! Thank You
Write a C language program to read two matrices and multiply them?
Write a C language program to read two matrices and multiply them?  Write a C language program to read two matrices and multiply them?   Here is an example of multiplying two matrices using C language. #include <
C language
C language  i want that when i hit any key only * to be print not the hit key in c language   The given example will display aestricks on hitting any key. #include "stdio.h" #include "conio.h" #include "ctype.h" int
C Language
C Language  Respected sir, Why does sizeof report a larger size than I expect for a structure type, as if there were padding at the end? help me sir
C Language
C Language  Respected Sir, How can I determine the byte offset of a field within a structure? How can I access structure fields by name at run time? please help me sir . Thank you sir
c language code
c language code  Dear Sir, Could you send me the c language codings for BOOK BANK
c-language pointer functions
c-language pointer functions  what is the execution process of character pointer functions with example
logic for c language
logic for c language  01 02 03 04 05 06 20 21 22 23 24 07 19 32 33 34 25 08 18 31 36 35 26 09 17 30 29 28 27 10 16 15 14 13 12 11
Change case in C language
Change case in C language  I want to right in .dat file through structure.For this i have defined following: struct student //structure defination... If user is typing b5678 ,i want to store as B5678. (C)for input i am using
C Language - Java Beginners
C Language  1. What are extension files? Give examples. 2. What is operating system? What are the different types available? 3. What is the purpose of operating system? 4. What is the function of operating system? 5
hotel management programme in c language?
hotel management programme in c language?  hotel management programme in c language
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  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
about c and java
about c and java   i need java and c language interview and objective questions with answers for the fresher.please provide to me   Please...://www.roseindia.net/c-tutorials/ http://www.roseindia.net/interviewquestions
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  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 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  WAP to show the area of a perimeter of a rectanglar by using input command
c program
c program  How to convert binary digits to decimal number without using power function
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 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
C++ programming language - Java Beginners
C++ programming language  int main() { int i = 1, c = 0, sum = 1,j ; scanf("%d", &j); while (i <= j) { sum = sum + (i /3+i/5); printf
c programming language - Java Beginners
c programming language  int main() { int i = 1, c = 0, sum = 1,j ; scanf("%d", &j); while (i <= j) { sum = sum + (i /3+i/5); printf("%d
about a program
about a program  hi can anyone suggest program for this question.. it wil really be helpful.its based on *servlet programming* 1. First page should display a dropdown of mathematical operation (Add, Subtract, Multiply, Divide
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 - Java Beginners
c program  Write a program to encrypt a string and decrypt
C program - SQL
C program  Write a C program for airport simulation using queue data structures. Please reply me
C language-qsort and bsearch function - Ajax
C language-qsort and bsearch function  Explain qsort and bsearch...() #include #include #include #include char alpha[] = {'a','b','c...); if(p) printf(" %c is in alphabet\n", *p); else printf("is not in alphabet\n
Main function parameter in C language - Ajax
Main function parameter in C language  Please let me know how... as the starting point for program execution. It usually controls program execution by directing the calls to other functions in the program. A program usually
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 - 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 - 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 - 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 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 Language - Design concepts & design patterns
C Language  What is meant by %u in printf statement in c? for example,%d means integer value,like that what is %u?  Hi Friend, %u is used to print an unsigned integer. Unsigned integers are non-negative numbers
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
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 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++ 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....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 - 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
About JSP Expression Language - JSP-Servlet
About JSP Expression Language   Hi i am new to JSP i am now going through the basics of JSP..on the process i tried a simple JSp program... pls help... Scriptlets <% %>.Your program of Addition of two values in JSP would be as fellow
Objective-C keywords
Objective-C keywords       Here in this section we will know about the keywords used in objective-C language. Objective-C is a superset of C language, so program written in c
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
Why Objective C?
; In this section we will learn about the importance of Objective C and "Why Objective C?" is used as programming language to develop applications... organized language ?Objective-C language is selected for the Cocoa framework
Advertisements
 

 

 

DMCA.com