Can You Write A "C" Program To Find The Sum Of 1,2,3,4,5 Using For Loop?

5 Answers

Prashant Profile
Prashant answered
Start;

int sum = 0;
for (int I = 1; I
Anonymous Profile
Anonymous answered
#include<stdio.h>#include<conio.h>void main(){ int I;for(I=1;I<=5;I++)printf("%d",I);getch();}
MATHAVAN SRINIVASAN Profile
Main()
{
int I,sum=0;
for(I=1;I
John Nawrocki Profile
John Nawrocki answered
// This compiled under Microsoft C but is generic and
// should be OK with any compiler
#include "stdafx.h"
#include

void main()
{
int index;
int answer;
answer=0;
for (index=0;index<5;)
{
index += 1;
answer+= index;
}
printf("The answer is %d",answer);
index = getch();
}
Anonymous Profile
Anonymous answered
#include
void main( )
{
int a, b, c, d, e, count;
float x, sum;
printf("The numbers are 1, 2, 3, 4, 5");
scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
for(count=x; count

Answer Question

Anonymous