diff --git a/FizzBuzz.md b/FizzBuzz.md new file mode 100644 index 0000000..d881d86 --- /dev/null +++ b/FizzBuzz.md @@ -0,0 +1,31 @@ +// CPP program to print Fizz Buzz +#include + +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; +} diff --git a/Student.md b/Student.md new file mode 100644 index 0000000..e98abda --- /dev/null +++ b/Student.md @@ -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