Print average of first 5 numbers using for loop in java
Answers
Answered by
0
Answer:
class loop
{
public static void main ( String abc [ ] )
{
int i , s = 0;
double avg , c = 0 ;
for ( i = 1 , i <= 5 , i ++ )
{
s = s + i ;
c ++ ;
}
avg = s / c ;
System • out • println ( avg + " is the average of first 5 nos ");
}
}
Explanation:
HOPE IT WILL DEFINITELY HELP YOU PLZ HELP ME ALSO BY MARKING THIS ANSWER AS BRAINLIEST ................
Similar questions
Math,
9 days ago
Science,
9 days ago
English,
19 days ago
Sociology,
9 months ago
India Languages,
9 months ago