Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Student.md #253

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions FizzBuzz.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// CPP program to print Fizz Buzz
#include <stdio.h>

int main(void)
{
int i;
for (i=1; i<=100; i++)
{
// number divisible by 3 and 5 will
// always be divisible by 15, print
// 'FizzBuzz' in place of the number
if (i%15 == 0)
printf ("FizzBuzz\t");

// number divisible by 3? print 'Fizz'
// in place of the number
else if ((i%3) == 0)
printf("Fizz\t");

// number divisible by 5, print 'Buzz'
// in place of the number
else if ((i%5) == 0)
printf("Buzz\t");

else // print the number
printf("%d\t", i);

}

return 0;
}
58 changes: 58 additions & 0 deletions Student.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import java.util.*;
class StudentA
{
protected String name;
protected int roll_no;
void read()
{
Scanner reader=new Scanner(System.in);
System.out.println("Enter Student name");
name=reader.next();
System.out.println("Enter Student Roll number");
roll_no=reader.nextInt();
}
String display()
{
return name;

}
}

public class Experiment4StudentArray {

public static void main(String[] args) throws ArrayIndexOutOfBoundsException
{
Scanner reader=new Scanner(System.in);
try
{
System.out.println("Enter number of Students");
int n=reader.nextInt();
StudentA s[]=new StudentA[10];
int i;
for(i=0;i<n;i++)
{
s[i]=new StudentA();
s[i].read();

}
System.out.println("Enter the starting character ");
String start=reader.next();
start=start.toLowerCase();
for(i=0;i<s.length;i++)
{
String getname=s[i].display();
getname=getname.toLowerCase();
if(getname.startsWith(start))
{
System.out.println("Student Name is "+s[i].name+" Roll number is "+s[i].roll_no);
}
}
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Exception "+e+" occured");
}
}
}