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.

Answers were Sorted based on User's Feedback



write a c program, using for loop, that accepts and odds two numbers. The output must be the sum an..

Answer / 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

write a c program, using for loop, that accepts and odds two numbers. The output must be the sum an..

Answer / sravan

#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 ?    10 Yes 7 No

Post New Answer

More C++ Code Interview Questions

Deriving time complexity of Binary tree and AVL tree, step by step.

4 Answers   NetApp,


program to find the magic square using array

1 Answers  


1. Write a program using one dimensional array that calculates the sum and average of the five input values from the keyboard and prints the calculated sum and average.

2 Answers  


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

0 Answers  


void main() { int i,j=2; for(i=0;i<3;i++) if(j=i) cout<<"Lotus "; else cout<<"Rose "; } Its result is Rose Lotus Lotus.. How? Explain it?

2 Answers  






swap prog

3 Answers   TCS,


using friend function find the maximum number from given two numbers from two different classes.write all necessary functions and constructor for the classes.

1 Answers   TCS,


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

0 Answers  


write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

0 Answers   HCL,


Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and with complexity T(n) is at most about (1.5)n comparisons.

10 Answers   ABC, College School Exams Tests, ITC Infotech, Kyambogo University, Qatar University,


Code for Easily Using Hash Table?

0 Answers  


Write code for the multiplication of COMPLEX numbers?

0 Answers   IBM,


Categories