Posts

GAC COLLEGE

Image
MUNNAI MANAKKAR SANGAM Government Arts  College(Autonomous)                           Government Arts College (GAC), Kumbakonam, is one of South India's oldest educational institutions,  founded as a  provincial school  in 1854 by the British on the banks of the Cauvery River , earning it the nickname "the Cambridge of South India". It evolved from a school to a full-fledged government college, gaining affiliation with the University of Madras in 1877 and becoming autonomous in 1987, known for its rich history, historic architecture, and famous alumni like Srinivasa Ramanujan.                                                                                     MUNNAI MANNAKAR SANGAM ...

basic conditions and loops

Image
1. Bus Ticket Counter Story: A conductor issues tokens to passengers. Each passenger must get a number in sequence. Why: Helps students learn loops. Logic: Input: number of passengers. Use for loop to print numbers 1 to n . Extension: use if inside loop to print only even tokens. Program: import java.util.Scanner; public class tokens{     public static void main(String[] args){         Scanner sc=new Scanner(System.in);         System.out.println("Enter number of passengers:");         int n=sc.nextInt();         for(int i=1;i<=n;i+=2){             System.out.println("Only print even numbers:");          }     } } OUTPUT: 2. Shop Discount Calculator S tory: A shop applies discounts depending on bill amount. Why:  Introduces  if-else  conditions. Logic: Input: bill amount. If bill < 1000 → ...

for and while challenges

Image
  1. Print numbers from 1 to 10. public class printnum{     public static void main(String[] args){ System.out.println("Print numbers from 1 to 10"); for(int i=1;i<=10;i++){     System.out.print(i + " "); }   }     } OUTPUT: 2. Print even numbers between 1 and 20. class evennum {     public static void main(String[] args){        System.out.println("Print even numbers between 1 and 20");         for(int i=2;i<=20;i+=2){             System.out.print(i + " ");         }     } OUTPUT: 3. Print the multiplication table of a given numbers. class multiplicationtable {     public static void main(String[] args){         int n=1, m=7;         while (n<=10){             System.out.println(n +" X "+ m +" = " + (n*m));          n...