# Answer to Question #10341 in C++ for Benjamin

Question #10341

c program that generate all even numbers between 1 and 100 and sum two fractions

Expert's answer

#include "stdafx.h"

#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

int sum=0;

cout<<"Even numbers:";

for(int i=1;i<=100;i++){

if(i%2==0){

cout<<i<<" ";

}

sum+=i;

}

cout<<"

Sum of two fractions is "<<sum/2;

int k;

cin>>k;

return 0;

}

#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

int sum=0;

cout<<"Even numbers:";

for(int i=1;i<=100;i++){

if(i%2==0){

cout<<i<<" ";

}

sum+=i;

}

cout<<"

Sum of two fractions is "<<sum/2;

int k;

cin>>k;

return 0;

}

## Comments

## Leave a comment