0

# Find the sum of 1 plus 2 plus 3 plus . plus n nos using c program?

Updated: 11/18/2022

Vishalchetrie

Lvl 1
15y ago

if (n%2==0) sum=n/2*(n+1);

else sum=(n+1)/2*n;

Wiki User

15y ago

Earn +20 pts
Q: Find the sum of 1 plus 2 plus 3 plus . plus n nos using c program?
Submit
Still have questions?

### Using while loop write a program which calculates the product of digits from 1 to 5 and also show these nos vertically?

Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.

### Write a c program to sort three integer numbers using nested if statement?

// HI THIS IS MAYANK PATEL /*C Program to find Maximum of 3 nos. using Nested if*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int a,b,c; // clrscr(); printf("Enter three number\n\n"); scanf("d%d",&amp;a,&amp;b,&amp;c); if(a&gt;b) { if(a&gt;c) { printf("\n a is maximum"); } else { printf("\n c is maximum"); } } else { if(b&gt;c) { printf("\n b is maximum"); } else { printf("\n c is maximum"); } } getch(); }

### Could u draw me a flowchart for this C program question 1.sum of nos. from 1 to n Check the no. in odd or even?

1. Read in 'n'2. Output n*(n+1)/2> Check the no. in odd or even?Both possible, has no significance.

### Program to sort numbers in c plus plus?

/* Bubble sort: code snippet only nos to be sorted are in the array named 'n' of size 'N' for(int i=0;i&lt;N-1;i++) for(int j=i+1;j&lt;N-1-i;j++) if(n[j]&gt;n[j+1]) swap(n[j],n[j+1]); */ /* insertion sort int v,j; for(int i=1;i&lt;N;i++) { v=n[j]; for(int j=i-1;j&gt;0&amp;&amp;n[j]&gt;v;j--) n[j+1]=n[j]; n[j+1]=v; } */

Related questions

### Find the greater no between two nos using pointer in c plus plus programming?

if (*&amp;a &gt; *&amp;b) *&amp;max = *&amp;a; else *&amp;max = *&amp;b;

10

### Coding in c plus plus to swap two nos using pointer?

void swap (int &amp;pa, int &amp;pb) { *pa ^= *pb; *pb ^= *pa; *pa ^= *pb; }

### Using while loop write a program which calculates the product of digits from 1 to 5 and also show these nos vertically?

Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.

### How do you use super Nos Pump to lose weight?

How do you lose weight using super nos pump

### Differtiate window NOS over unix NOS?

If both Windows and Unix are using TCP/IP as their primary NOS there isn't much difference to speak of.

### C program for summation of n nos using recursion?

int sum (int n) { if (n&lt;=1) return n; else return n + sum (n-1); }

### How do you find the sum of nos in a series?

It depends on the series.

### What is the best place to get nos?

There are quite a few places to obtain nos. You can try dougstubes,kcanostubes or thegearpage, These are all great sources to find nos tubes at a great price. Hope this helps you out.

### What does a ver que nos encontramos mean?

To see what we find.

### Write a c program to print the 100 to 1 nos?

Write a c program to print the 100 to 1 nos

### How would you answer in spanish using the person Miguel Quien les sirvio el pescado asado?

Miguel nos/se lo sirvio. ('Nos' - us. 'Se' - them)