Daisypath Anniversary tickers

Daisypath Anniversary tickers

Thursday, April 7, 2011

More exercise....

1) Complete the code that can calculate total marks for 3 students
for(int stud=1;____(a)____;stud++)
{
cout<<"Enter Student name:";
____(b)____name;
for(int mark=1;mark<=3;____(c)____)
{
cout<<"Enter assigment marks:";
cin>>marks;
total=____(d)____+marks;
}
}
cout<<"Total marks are"<<____(e)____;

answer

(a) stud<=3
(b) cin>>
(c) mark++
(d) total
(e) total

2) Based on the short code below :
Change for loop statement below to while loop
for(x=1;x<=5;x++)
cout<
answer

x=1;
while(x<=5)
cout<x++

3) Write the code using while loop to get the output as below !
20
15
10
5

answer

x=20
while(x<=5)
cout<<" "<x--;

No comments:

Post a Comment