2/23/2011

BCT1113 CP lab 24/2/2011


Write a program that asks the user to type 10 integers and writes the sum of these integers. Use either while or do-while or for loop. Start with a pseudocode and flowchart.


Flowchart



C++ Program


#include<iostream.h>

int main(void)

{

int n;

int sum =0;

int counter = 1;

while(counter <=10)

{

cout<<"sila masukkan no ";

cin>>n;

sum = sum +n;

counter = counter +1;

}

cout<<"Hasil tambah 10 nombor ialah : "<<sum;

return 0;

}

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...