I want to write a program that enter the marks of n of student out of 100%, students who are (marks>=65) pass otherwise failed, want to print number of students who'r passed and failed ?

I solved but wont work ><

To enter nth marks of student need loop, then use if, else
but how can I print the number.

Member Avatar for iamthwee

Do you have any code to show us?

This is totally wrong :'(


want to dispaly only the marks and number of students who'r passed and failed.

# include <iostream>

using namespace std;

int main ()

{
    int marks,i,stu_pa=0,stu_fa=0,sum=0;
    
    cin>>num;
    
    for(i=1;i<=num;i++)
    {
       cout<<"Enter the marks of student out 100: ";
       cin>>marks;
       
       if(marks>=65)
       {
                stu_pa=num;
                cout<<stu_pa<<"\npassed\n"<<endl;
       }
       
       else
       {
                stu_fa=nun-stu_pa;
                cout<<stu_fa<<"\nfailed\n"<<endl;
       }
               
     
     }

}
Member Avatar for iamthwee
#include <iostream>

using namespace std;

int main ()
{
   int marks, i, stu_pa = 0, stu_fa = 0, sum = 0;
   cin >> num;

   for ( i = 1; i <= num; i++ )
   {
      cout << "Enter the marks of student out 100: ";
      cin >> marks;
      if ( marks >= 65 )
      {
         stu_pa = num;
         cout << stu_pa << "\npassed\n" << endl;
      }
      else
      {
         stu_fa = nun - stu_pa;
         cout << stu_fa << "\nfailed\n" << endl;
      }
   }
}

num is undeclared and so is nun?

oh i wrote it quickly >< even if i correct them still wont work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.