write a c program, using for loop, that accepts and odds two
numbers. The output must be the sum and the addens. This
should be repeated 5 times while the first number is
decremented by one and the second number is incremented by 1.

Answer Posted / ankur srivastava

#include<stdio.h>
void main()
{int a,b,m=1;
printf("enter the two no\n");
scanf("%d %d",&a,&b);
while(m<=5)
{
printf("sum of %d and %d is %d \n",a,b,(a-- + b++));
m++;
}
}

Is This Answer Correct ?    25 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2061


How to Split Strings with Regex in Managed C++ Applications?

3120


Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

2908


solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

2930


How to swap two ASCII numbers?

2442






A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

2396


write a program to perform generic sort in arrays?

2619


how to write a program that opens a file and display in reverse order?

2561


write a program that can LOCATE and INSERT elements in array using c++ programming languages.

3431


output for printf("printf");

1977


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

2188


Code for Method of Handling Factorials of Any Size?

2000


how to diplay a external image of output on winxp by using c & c++,

2930


Code for Easily Using Hash Table?

2385


How can I Draw an ellipse in 3d space and color it by using graph3d?

2130