Computer Science, asked by pragunt, 19 days ago

Print average of first 5 numbers using for loop in java

Answers

Answered by adityaadarsh961
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