Display Pattern:
1
2 3
4 5 6 7
8 9 10 11 12 13 14 15
…

Answers were Sorted based on User's Feedback



Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 … ..

Answer / yana

listing program c++ 1,1,3,2,5,7,3,9,11,4,13,15

Is This Answer Correct ?    2 Yes 3 No

Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 … ..

Answer / gowtham

#include<stdio.h>
#include<conio.h>
main()
{
int n,i,s=0;
clrscr();
printf("Enter n value:");
scanf("%d",&n);
for(i=0;i<=8230;i++)
{
s=s+1;
}
printf("%d",s);
getch();
}

Is This Answer Correct ?    3 Yes 10 No

Post New Answer

More C++ Code Interview Questions

swap prog

3 Answers   TCS,


using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.

2 Answers  


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

0 Answers  


a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.. ""EXAMPLE"" enter how many numbers to be inputted: 5 12 14 11 09 30 what number to search: 11 11 IS FOUND IN LOCATION 3 PLZZZ.. ELP ME...

3 Answers  


Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

0 Answers  






how to find out the maximum number out of the three inputs.

6 Answers   ABC, Apple, C3I, HP, TCS,


what is the diffrence between ++x , x++ pleaaaaase ???

7 Answers  


Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.

0 Answers  


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.

2 Answers   IBM, Infosys,


Algorithm in O(2n) Presently we can solve in our hypothetical machine problem instances of size 100 in 1 minute using algorithm A, which is a O(2n). We would like to solve instances of size 200 in 1 minute using algorithm A on a new machine. What is the speed of the new machine should be?

2 Answers   ABC, Qatar University,


What is the time complexity T(n) of the following program? a) int n, d, i, j; cin >> n; for (d=1; d<=n; d++) for (i=1; i<=d; i++) for (j=1; j<=n; j += n/10) cout << d << " " << i << " " << j << endl; b) void main() { int n, s, t; cin >> n; for (s = 1; s <= n/4; s++) {t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } } c) void main() { int n, r, s, t; cin >> n; for (r = 2; r <= n; r = r * 2) for (s = 1; s <= n/4; s++) { t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } }

3 Answers   CTS, IBM, Infosys, Qatar University,


write a function -oriented program that generates the Fibonacci, the current numbers of n(as input) and display them (series). In Fibonacci, the current third number is the sum of the previous number.

3 Answers  


Categories