1int i=0;
2int sum=0;
3while (i < 100) {
4if (i % 2 == 0) {
5for (int k = 0; k < n; k++) {
6sum += vec[i];
7}
8}
9else {
10for (int k=0; k<i; k++) {
11sum += vec[i];
12}
13}
14}
1#include <iostream>
2using namespace std;
3
4int recursive_sum(int m, int n) {
5 if (m == n)
6 return m;
7 return m + recursive_sum(m + 1, n);
8
9}
10
11int main()
12{
13 int m=1, n=5;
14 cout<<"Sum = "<<recursive_sum(m, n);
15}
16
1for (int i = 1 ; i <= N-1 ; i++)
2{
3 if ( i < 1 ) //assume always False
4 {
5 A = i + 10;
6 B = A + N;
7 }
8 else if ( i > N) //assume always False
9{
10 A = i +5;
11 B = A + 10;
12}
13else
14{
15 A = i + 20;
16 B = A + 5;
17}
18}
19
1for(int i = 0; i < N-1; i++)
2{
3if (data[i] >= 0) //Assume always true
4{
5Count(i,N);
6Display();
7}
8else
9{
10Console.Write(“Wrong input”);
11data[i] = 0;
12}
13}
14public void Count(int first, int second)
15{
16hasil = first * second;
17data[first] = hasil;
18}
19public void Display()
20{
21for(int y=0; y < N; y++)
22{
23Console.Write(data[i]);
24Console.Write(hasil);
25}
26}
27