answersLogoWhite

0

The simplest solution is to use a std::set<size_t> sequence container to store the values as they are input. Duplicate entries are ignored automatically, thus when all 5 numbers have been input, the set will have at least 1 number but no more than 5. Thus the size of the set represents the count of distinct values that were input.

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

A program prints vertically a numbers in c program?

It is too easy................ //Program to print numbers vertically #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int last_no; int i; clrscr(); i=0; printf("Enter your last num.I will print 0 to that number"); scanf("%d",&amp;last_no); printf("\n"); while(i&gt;last_no) { printf("%d\n",i); i++; } getch(); } //poo.papule


Write a program that read phrase and print the number of lower-case letter in it using function of counting?

write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program


How do you write a program which reads a list of ten numbers and print the list in reserve order in c program?

The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.


How do you write a C program to find out perfect numbers from 1 and 50?

To find perfect numbers between 1 and 50 in a C program, you can iterate through each number in that range and check if it is equal to the sum of its proper divisors. A perfect number is defined as a number that is equal to the sum of its positive divisors, excluding itself. Here's a basic outline of the program: #include &lt;stdio.h&gt; int main() { for (int num = 1; num &lt;= 50; num++) { int sum = 0; for (int i = 1; i &lt;= num / 2; i++) { if (num % i == 0) sum += i; } if (sum == num) printf(&quot;%d is a perfect number\n&quot;, num); } return 0; } This code checks each number from 1 to 50 and prints out the perfect numbers found in that range.


How do you write a c program that prints a box an oval an arrow and a diamond?

You first learn how to program in C.

Related Questions

Create a program which accepts a number not less than 10The program prints the reverse of the number?

ten


Are tongue prints the same?

No, like fingerprints, tongue prints are unique to each individual. The large number of papillae on the tongue (bumps and ridges) create a distinct pattern that can be used for identification purposes.


How do you write a program in Q basic to print the sum of the even numbers from 1 to 20 in reverse order?

To write a program in QBasic that prints the sum of the even numbers from 1 to 20 in reverse order, you can follow these steps: DIM sum AS INTEGER sum = 0 FOR i = 20 TO 2 STEP -2 sum = sum + i NEXT i PRINT &quot;The sum of even numbers from 1 to 20 is: &quot;; sum This program initializes the sum to zero, iterates from 20 down to 2 in steps of -2 (to capture even numbers), adds each even number to the sum, and finally prints the result.


Program to print wvwn numbers from 1 to 100 in gw basic?

In GW-BASIC, you can print even numbers from 1 to 100 using a simple loop. Here’s a sample code: FOR i = 1 TO 100 IF i MOD 2 = 0 THEN PRINT i NEXT i This program iterates through numbers 1 to 100 and prints each number if it is even (i.e., divisible by 2).


When typing letters on the keyboard seemingly randomly prints some letters and numbers?

a number lock is on


A program prints vertically a numbers in c program?

It is too easy................ //Program to print numbers vertically #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int last_no; int i; clrscr(); i=0; printf("Enter your last num.I will print 0 to that number"); scanf("%d",&amp;last_no); printf("\n"); while(i&gt;last_no) { printf("%d\n",i); i++; } getch(); } //poo.papule


Write a program that read phrase and print the number of lower-case letter in it using function of counting?

write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program


How do you write a program which reads a list of ten numbers and print the list in reserve order in c program?

The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.


Demonstrate a program that prints numbers in ascending order.?

#include&lt;iostream&gt; int main() { for (int i=0; i&lt;100; ++i) std::cout&lt;&lt;i&lt;&lt;std::endl; }


What is one tool for reverse engineering software and five features of that tool?

hexadecimal dumper, which prints or displays the binary numbers of a program in hexadecimal format.


How can you cross reference an engine serial number with a VIN number for a 97 Suzuki Marauder VZ 800?

SUZUKI PRINTS A PUBLICATION THAT CROSS REFERENCES VIN NUMBERS TO ENGINE NUMBERS. THEY ARE SENT TO DEALERS.


Can someone help me I need to write a C program which prints all even numbers between 3 and 50 or writes No Answer if there aren't such then it should repeat the same action for the odd numbers?

I've made the following program according to your question #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main(void) { clrscr(); int a; printf("Enter your number\n"); scanf("%d",&amp;a); { if(a%2==0 &amp;&amp; a&gt;3 &amp;&amp;a&lt;50) { printf("This number is even %d",a); } else {printf("This number is not even"); } } getch(); }