Koykoy200078
Forum Veteran
- Joined
- Sep 11, 2016
- Posts
- 1,765
- Reaction
- 696
- Points
- 629
- Age
- 23
help po mga master na programmer jan, bagohan pa po lamang ako about ni .C Language my pinagawa po saamin ang teacher namin na " Input 5 Numbers and Display the 5 numbers with Sum " using the loops po, ito po pala yung full code ko pero isa lang po ang lumabas ayaw mag display ng 5 numbers
"user input 5 and display 5 numbers with the sum" yan po
#include <stdio.h>
int main()
{
int n, i, sum = 0;
printf("Enter a positive integer: ");
scanf("%d",&n);
for(i=1; i <= n; ++i)
{
sum += i; // sum = sum+i;
}
printf("Sum = %d",sum);
return 0;
}
"user input 5 and display 5 numbers with the sum" yan po
#include <stdio.h>
int main()
{
int n, i, sum = 0;
printf("Enter a positive integer: ");
scanf("%d",&n);
for(i=1; i <= n; ++i)
{
sum += i; // sum = sum+i;
}
printf("Sum = %d",sum);
return 0;
}
Last edited: