Computer Science, asked by srustijansari, 10 months ago

Draw a flowchart To find sum of first 20 odd numbers​

Answers

Answered by Badshah123
8

Answer:

Draw a flow chart of a program that adds N odd numbers starting from 1. The value of N should be input by the user.

Flowchart:- START

l

INPUT IN

I

FOR

I<NUN*2

l

IF

l%2 !=O

l

SUM=SUM+1

l

PRINT SUM

l

STOP

#include<stdio.h>

void main()

{

int NUM,i,SUM=0;

clrscr();

printf(“\nENTER INTERGER NUMBER : “);

scanf(“%d”,&NUM);

for(i=1;i<NUM*2;i++)

{

if(i%2!=0)

{

SUM=SUM+i;

}

}

printf(“\nTHE SUM OF ODD NOS. TILL %d NO. IS %d”,NUM,SUM);

getch();

}

Similar questions