Skip to content

First Year Elab Level 2 (2021)

    Download the Brave browser for copying the code into your Elab click on the button to download the browser.

    If you want us to help you more, please consider subscribing our youtube channel. It would mean a lot to us and it will show us that you want us to help you more.

    Table of Contents

    Ram was working as a Marketing Executive in Pepsi.

    #include <stdio.h>

    #include<math.h>

    int main()

    { int km; float lpd;

     float r;

        scanf("%d %f",&km,&lpd);

        r=km/lpd;

        printf("%.3f",r);

        return 0;}

    Sajid loves super heroes he used to imagine himself to be a hero.

    #include <stdio.h>

    #include<math.h>

    int main()

    {

        int a,b,c;

        float s,area;

        scanf("%d %d %d",&a,&b,&c);

        s=(a+b+c)/2;

        area=sqrt(s*(s-a)*(s-b)*(s-c));

        printf("%.2f",area);

     

                   return 0;

    }

    Johnson was working as a Captain of the Giant Ship.

    #include <stdio.h>

    int main()

    {

        int ndays,y,m,d;

        scanf("%d",&ndays);

        y=ndays/365;

        ndays=ndays-(365*y);

        m=ndays/30;

        d=ndays-(m*30);

        printf("%d Y(s) %d M(s) %d D(s)",y,m,d);

     

                   return 0;

    }

    Salima saw a pair of beautiful dress online but she was confused about the metric system used for the size of the dress

    #include <stdio.h>

    #include<math.h>

    int main()

    {

        int feet,inches; float cms; float lol;

        scanf("%d %d",&feet,&inches);

        lol=feet*12;

        cms=(lol+inches)*2.54;

        printf("Your height in centimeters is : %.2f",cms);            return 0;

    }

    Swathy and Nancy were selected for SpaceY programme which was about to take place the next year in their interview they were struck with the question.

    #include <stdio.h>

    int main()

    {

    float spacenum;

    int ip,rmd;

    scanf("%f",&spacenum);

    ip=spacenum;

    rmd=ip%10;

    printf("%d",rmd);

                   return 0;

    }

    Roopa and Atifa are sisters they love to compete by playing math games which gradually helped them in their academics one day.

    #include <stdio.h>

    int main()

    {

    float num1,num2;

    int sum;

    scanf("%f %f",&num1,&num2);

    sum=(int)num1+(int)num2;

    printf("%d",sum);

                   return 0;

    }

     

    Nathan was a student by morning and a computer nerd by night.

    #include <stdio.h>

    #include<math.h>

    int main()

    {

    int prodid,billid,quantity;

    float price,totprice;

    scanf("%d \n%d \n%f \n%d",&billid,&prodid,&price,&quantity);

    totprice=price*quantity;

    printf("%.2f",totprice);

                   return 0;

    }

    Mallaiah has deposited an amount in the bank.

    #include <stdio.h>

    #include<math.h>

    int main()

    {

        float amount,rate,time,si;

        scanf("%f",&amount);

        scanf("%f",&rate);

        scanf("%f",&time);

        si=(amount*rate*time)/100;

        printf("%.4f",si);

     

                   return 0;}

    2022 was approaching and the world was about to end.

    #include <stdio.h>

    int main()

    {int n,k;int j;

    scanf("%d %d",&n,&k);

    j=k/n;

    printf("%d",j);

    return 0;}

    Aaron took his girl friend Binita to a restauraunt as he got a job of his dreams.

    #include <stdio.h>

    #include<math.h>

    int main()

    {int billwt;

    float tax,tip,totaltax,totaltip,totalbill; scanf("%d",&billwt);

        totaltax=tax=billwt*0.18;

        totaltip=tip=billwt*0.05;

        totalbill=totaltax+totaltip+billwt;

        printf("The Tax is %.2f\n",totaltax);

        printf("The Tip is %.2f\n",totaltip);

        printf("Total Bill With Tax and Tip is %.2f\n",totalbill);

        return 0;

    }

     

    Tina and Fazil are participating in a contest.

    #include <stdio.h>

    #include<math.h>

    int main()

    {

        int n,a,b,k;

        scanf("%d %d %d %d",&n,&a,&b,&k);

        int count=0,f=0,i;

        for(i=1;i<=n;i++)

        {if (i%a==0 && i%b!=0)

        count++;

        else if (i%b==0)

        f++;

        }

        if (count+f>=k)

        printf("Win");

        else

        printf("Lose");

      

                   return 0;

    }

     

    Rashi’s classroom contains N-M tables distributed in a grid with N rows and M columns.

    #include <stdio.h>

    int main()

    {

        int n,m;

        scanf("%d %d",&n,&m);

        if(n*m%2==0)

        printf("YES");

        else

        printf("NO");

                   return 0;}

    Aarav a newbie entrepreneur was studying the profit and loss of his company.

    #include <stdio.h>

    int main()

    {

        int cp,sp;

        scanf("%d %d",&cp,&sp);

        if(cp>sp)

        printf("Loss");

        else if(cp<sp)

        printf("Profit");

        else

        printf("No Profit No Loss");

     

                   return 0;}

    The Paytm announced a Cashback offer for the people of Tamil Nadu which is a one time offer for the new year.

    #include <stdio.h>

    int main()

    {

    int currency;

    scanf("%d",&currency);

    (currency%2==0)?(printf("Even Currency")):(printf("Odd Currency"));

                   return 0;}

    Shree and Harry was living in the town of Denmark, they usually think and do something innovative on weekends

    #include <stdio.h>

    #include<math.h>

    int main()

    {   float number1,number2,approx;

        scanf("%f %f",&number1,&number2);

        if(number2>number1)

        {approx=number2-number1;

        if(approx<=1)

        printf("Approximate Number");

        else

        printf("Not an Approximate Number");}

        else

    {approx=number1-number2;

    if (approx<=1)

    printf("Approximate Number");  else   printf("Not an Approximate Number");}          return 0;}

    “I am not in danger, Girish. I am the danger.

    #include <stdio.h>

    int main()

    {

        int x,y;

        scanf("%d %d",&x,&y);int c;

        if((x-y)%2==0)

        c=(x>y)?1:3;

        else{if(x>y) c=2;

         else if (y>x) c=1;

         else c=0;}

          printf("%d",c);

                   return 0;}

    Roy wants to change his profile picture on Facebook.

    #include <stdio.h>

    int main()

    {

        int l,w,h;

        scanf("%d\n %d %d",&l,&w,&h);

        if(l>w||l>h)

        printf("UPLOAD ANOTHER");

        else if(w==h && w==l)

        printf("ACCEPTED");

        else

        printf("CROP IT");         return 0;}

    Abilash and Yazhini are friends who love to go for outing every month.

    #include <stdio.h>

    int main()

    { int month;

        scanf("%d",&month);

        switch (month)

        {case 1:

        printf("31 days"); break;

        case 2:

        printf("28/29 days");break;

        case 3:

        printf("31 days");break;

        case 4:

        printf("30 days");break;

        case 5:

        printf("31 days");break;

        case 6:

        printf("30 days"); break;

        case 7:

        printf("31 days");break;

        case 8:

        printf("31 days");break;

        case 9:

        printf("30 days");break;

        case 10:

        printf("31 days");break;

        case 11:

        printf("30 days");break;

        case 12:

        printf("31 days");break;

        default:

       printf("Invalid");

        }          return 0;}

    You are playing a Billiards-like game on an NxN table, which has its four corners at the points ((0,0), (0,N), (N,O), and (N,N)).

    #include <stdio.h>

    int main()

    {int n,k,x,y;

    int x1,x2,x3,x4,y1,y2,y3,y4;

    scanf("%d %d %d %d",&n,&k,&x,&y);

    x1=x+n-x;

    y1=y+n-x;

    x2=y1;

    y2=x1;

    x3=x2-x2;

    y3=y2-x2;

    x4=y3;

    y4=x3;

    if(x1==y1)

    printf("%d %d",x1,y1);

    else

    {    if(k%4==1)

        printf("%d %d",x1,y1);

        else if (k%4==2)

        printf("%d %d",x2,y2);

        else if (k%4==3)  printf("%d %d",x3,y3);   else    {printf("%d %d",x4,y4);}}   return 0;}

    Fazil and Yathra are playing a game.

    #include <stdio.h>

    int main()

    {

        int a,b,c,d,n;

        scanf("%d %d %d",&a,&b,&n);

        c=(2*a)/b;

        d=(4*a)/(2*b);

        if(n==1){

            printf("%d",c);

        }else if (n%2==0){printf("%d",a/b);

           

        }

        else

        printf("%d",d);

                   return 0;

    }

     

    Snowbell is a little cat.

    #include <stdio.h>

    void rem();

    int main()

    { rem();

     

    return 0;

    }

    void rem(){

    int t;

    scanf("%d", &t);

    while(t–){

    int n,k,i,max;

    scanf("%d %d", &n,&k);

    max = n%2;

    for(i = 2; i <=k;i++){

    if(n%i>max){max = n%i;}

    }

     

    printf("%d\n", max);

    }

    }

    You probably know the game where two players in turns take 1 to 3 balls from a pile.

    #include <stdio.h>

    int main()

    {int t,n,m,i;

     

    scanf("%d\n%d %d,",&t,&n,&m);

    int a[m],set = 0;

    while(t–){

    for(i=0;i<m;i++){scanf("%d",&a[i]);}

     

    if(m%2==0)

    set=1;

    else

    set=2;

    }

    printf("%d",set);

    return 0;

    }             

     

    The eagles want to build a temple for Lord Eagle.

    #include <stdio.h>

    int main()

    {int t,i,n;

     

    scanf("%d",&t);

    while(t–){

    scanf("%d",&n);

    int a[n];

    for(i=0;i<n;i++){

    scanf("%d",&a[i]);

    }

    if(n%2==0){

    printf("no\n");

    }

    else if(a[0]!=1||a[n-1]!=1||a[1]!=2||a[n-2]!=2){

    printf("no\n");

    }

    else{ printf("yes\n");}}

     

    return 0;

    }

     

    Bachgold problem is very easy to formulate.

    #include <stdio.h>

    int main()

    {

    int pos,i;

    scanf("%d",&pos);

    printf("%d\n",pos/2);

    for(i=0;i<(pos/2)-1;i++) printf("2 ");

    if(pos%2==0) printf("2");

    else if (pos%2==1) printf("3");

                   return 0;

    }

    Venkatesa Raja is an National award wining craft artist who is famous for his “Bhakthakrisha”, a painting on traditional Thanjavur style when he was barely 20 years.

    #include <stdio.h>  

    int main()

    {int A[10][10],t,n,i,j;

    scanf("%d",&t);

    while(t–)

     { scanf("%d",&n);

         for(i=1;i<=n;i++)

    {for(j=1;j<=n;j++)

         scanf("%d",&A[j][i]);

    }

    for(j=1;j<=n;j++)

    {for(i=n;i>=1;i–)

    printf("%d ",A[j][i]);

    }printf("\n"); }return 0;}  

    Yaswanth need to find a string which has exactly K positions in it such that the character at that position comes alphabetically later than the character immediately after it.

    #include <stdio.h>

     

    #include <string.h>

     

    int main()

     

    {char K[105];

     

    char t[]="This is SHIT";

     

    int n,v,i;

     

    char c = 'a';

     

    scanf("%d",&n); while(n>0){

     

    scanf("%d",&v); for (i = v; i >=0; i–){ printf("%c", (c+i));}

     

    strcat(K,t); printf("\n");

     

    n–;

    }

    return 0;

     

    }

     

    Peter given two binary strings A and B with the same length to Sumesh.

    #include <stdio.h>

    #include <string.h>

    int indexfind(int n,int i,char A[],char B[]){

    while(i<n &&A[i] != B[i]) i+= 2;

    return i;

    }

    int main()

    {

    int t,i;

    scanf("%d",&t);

    for(i = 0 ; i<t; i++){

    char A[100000]; char B[100000];

    scanf("%s %s",A,B);

    int n = strlen(A);

    int opr = 0 ,j;

    for(j = 0 ; j<n; j+=2){

    if(A[j] != B[j]){

    j = indexfind(n,j,A,B);

    opr++;

    }

    }

    for(j = 1; j<n; j+=2){

    if(A[j] != B[j]){

    j = indexfind(n,j,A,B);

    opr++;}}

    printf("%d\n",opr);}

    return 0;}

    Bommi’s Bakery is located near the popular Arts college in the city.

    #include <stdio.h>

    #include <string.h>

    int main()

    {char a[5] = "010";

    char b[5] = "101";

    int t,n,i;

    char str[100001];

    scanf("%d",&t);

    for(i=0;i<t;i++){

        scanf("%s",str);

        n=strlen(str);

        if(strstr(str,a) !=NULL || strstr(str,b) !=NULL){

            printf("Good\n");

            n–;

        }

    else{

        printf("Bad\n");

        n–;

    }

    }

                   return 0;

    }

     

    Given 'n' words w[1..n], which originate from the same stem (e.g. grace, graceful, disgraceful, gracefully), we are interested in the original stem.

    #include <stdio.h>

    #include <string.h>

    int main()

    {int t,n,len,i;

    char s[10][30];

    scanf("%d",&t);

    while(t>0){

        scanf("%d",&n);

        for(i=0;i<n;i++){

            scanf("%s",s[i]);

        }

      len =strlen(s[0]);

      int bak=strcmp(s[1],s[0]);

      for(i=0;i<len;i++){

          if(strstr(s[1],s[0]) !=NULL){

              printf("%s",s[0]);

              break;

          }

       else{

           s[0][len-i-1]='\0';

           bak–;

       }

    }

    printf("\n");

    t–;

    }              return 0;}

    Yasir wants to set problems for a Breakfast time contest.

    #include <stdio.h>

    #include <string.h>

    int main()

    {

    int t, n,m,i,c0,c1,c2;char a[100],b[1000];

    scanf("%d",&t);

    while(t–)

    {

    m=strlen(a);

    c0=c2=0;

    scanf("%d %d",&n,&m);

    while(n–)

    {

    c1=0;

    scanf("%s %s",a,b);

    if(strcmp(a,"correct")==0)

    {

    for(i=0;i<m;i++)

    {

    if(b[i]=='0')

    {

    c0=1;

    break;

     

    }

    }

    }

    if(strcmp(a,"wrong")==0)

    {

    for(i=0;i<m;i++)

    {

    if(b[i]=='1')

    {

    c1++;

    }

    }

    if(c1==m)

    {

    c2=1;

    }

    }

    }

    if(c0==1) printf("INVALID\n");

    else if(c2==1) printf("WEAK\n");

    else if(c0==0 && c2==0) printf("FINE\n");

    }

    return 0;

    }

     

    Ravi is a mathematician who wants to teach Reverse Polish Notation to his students.

    #include <stdio.h>

    char s[300];

    int top=-1;

    void push(char c)

    {s[++top]=c;

    }

    char pop()

    {

        return s[top–];

    }

    int main()

    {int n,i,j;

    char str[400],cc;

    scanf("%d",&n);

    for(i=0;i<n;i++)

    {j=0;

    scanf("%s",str);

    while(str[j]!='\0')

    {    if(str[j]>=97&&str[j]<=122)

        printf("%c",str[j]);

        else if(str[j]!=')')

        push(str[j]);

        else{

            while((cc=pop())!='(')

            printf("%c",cc);

        }

        j++; }printf("\n");}         return 0;}

    Irfan enjoys listening to music.

    #include <stdio.h>

    int i,j;

    int minimum(int a,int b)

    { if(a>b)

    return 1;

    else

    return 0;

    }

    int partition(int arr[],int low,int high)

    { for(i=1;i<=high;i++)

    { if(arr[i]==low)

    { printf("%d\n",i);

    break;

    }

    }

    return 0;

    }

    void swap(int *a,int *b)

     

    {

    *a=*a + *b;

    *b=*a – *b;

    *a=*a – *b;

    }

    void quickSort(int arr[],int low,int high)

    { for(i=1;i<=high;i++)

    { for(j=i+1;j<=high;j++)

    { if(minimum(arr[i],arr[j]))

    swap(&arr[i],&arr[j]);

    }

    }

    partition(arr,low,high);

    }

    int main()

    { int t,n,pos,value,arr[20];

    scanf("%d",&t);

    while(t–)

    { scanf("%d",&n);

    for(i=1;i<=n;i++)

    scanf("%d",&arr[i]);

    scanf("%d",&pos);

    value=arr[pos];

    quickSort(arr,value,n);

     

    }

    return 0;

    }

     

     

    Chopsticks are short, frequently tapered sticks used in pairs of equal length, which are used as the traditional eating utensils of China, Japan, Karea and Vietnam.

    #include <stdio.h>

    int i, j;

     

    int quickSort(int A[],int l,int r) { int temp; for(i=0;i<l;i++) { for(j=i+1;j<r;j++) { if(A[i]>A[j])

     

    { temp=A[i]; A[i]=A[j];

     

    A[j]=temp;

     

    }}}

     

    return A[20];

     

    } int partition(int A[],int l,int r)

     

    { int count=0; for(i=0;i<l;i++)

     

    { for(j=i+1;j<r;j++) {if(A[i]!=0)

     

    { count++; A[i]=A[j]=0;

     

    }}} return count;

     

    } int main()

     

    { int i,n,max,A[1001], count; scanf("%d%d",&n,&max);

     

    for(i=0;i<n;i++) scanf("%d",&A[i]);

     

    quickSort(A,n,n); count=partition(A,n,n);

     

    printf("%d", count); return 0;}

     

     

    Issac loved to do agriculture he worked for a 9-5 job in the week days and dedicated to do agriculture on the week end.

    #include <stdio.h>

    int main()

    {

        float tractLand,tractLandAcred;

        scanf("%f",&tractLand);

        tractLandAcred=tractLand/43560;

        printf("%.2f sq.ft is equal to %.2f acres",tractLand,tractLandAcred);

     

                   return 0;

    }

    Swathy and Nancy were selected for SpaceY programme which was about to take place the next year in their interview they were struck with the question.

    #include <stdio.h>

    int main()

    {

        float spacenum;

        int ip,rmd;

        scanf("%f",&spacenum);

        ip=spacenum;

        rmd=ip%10;

        printf("%d",rmd);

     

                   return 0;

    }

    Arif planned to make a room cleaning robot for his college mini project competition.

    #include <stdio.h>

    int main()

    {

        float length,width,area;

        scanf("%f %f",&length,&width);

        area=length*width;

        printf("%.2f sq.ft",area);

                   return 0;

    }

    Surya was used to wear a smartwatch when he was in the Treadmill and during Cycling.

    #include <stdio.h>

    int main()

    {

        int sec,h,m,s;

        scanf("%d",&sec);

        h=sec/3600;

        m=(sec-(3600*h))/60;

        s=(sec-(3600*h)-(m*60));

        printf("%dH:%dM:%dS",h,m,s);

     

                   return 0;

    }

    Ram was working as a Marketing Executive in Pepsi.

    #include <stdio.h>

    int main()

    {

        int km;

        float lpd;

        float ans;

        scanf("%d %f",&km,&lpd);

        ans=km/lpd;

        printf("%.3f",ans);

     

                   return 0;

    }

    Johnson was working as a Captain of the Giant Ship.

    #include <stdio.h>

    int main()

    {

        int ndays,y,m,d;

        scanf("%d",&ndays);

        y=ndays/365;

        m=(ndays-(365*y))/30;

        d=(ndays-(365*y)-(m*30));

        printf("%d Y(s) %d M(s) %d D(s)",y,m,d);

     

                   return 0;

    }

    Arulmozhivarmon’s Dream come true after he got an Appointment order from Google Simon’s family was very happy of his achievement.

    #include <stdio.h>

    int main()

    {

        int GrossPayment,basic,da,hra;

        scanf("%d %d %d",&basic,&da,&hra);

        GrossPayment=(basic*(da+hra)/100)+basic;

        double s=GrossPayment-0.5;

        printf("%.lf",s);

       

     

                   return 0;

    }

    Nathan was a student by moming and a computer nerd by night

    #include <stdio.h>

    int main()

    {

        int prodid,billid,quantity;

        float price,totprice;

        scanf("%d %d %f %d",&billid,&prodid,&price,&quantity);

        totprice=price*quantity;

        printf("%.2f",totprice);

     

                   return 0;

    }

    Karthik was working in the HR division of Audi

    #include <stdio.h>

    int main()

    {

        int hour;

        double salaryperday,totsalary;

        scanf("%d %lf",&hour,&salaryperday);

        totsalary=hour*salaryperday;

        printf("%.2lf",totsalary);

     

                   return 0;

    }

    Salima saw a pair of beautiful dress online but she was confused about the metric system used for the size of the dress

    #include <stdio.h>

     

    int main()

    {

        int feet,inches;

        float cms;

        scanf("%d %d",&feet,&inches);

        cms=(feet*12*2.54)+(inches*2.54);

        printf("Your height in centimeters is : %.2f",cms);

     

                   return 0;

    }

    An elephant decided to visit his friend. It turned out that the elephant’s house is located at point 0

    #include <stdio.h>

    int main()

    {

        int n,count=0;

        scanf("%d",&n);

        if(n%5==0){

            count=n/5;

            printf("%d",count);

        }

        else{

            count=(n/5)+1;

            printf("%d",count);

        }

     

                   return 0;

    }

    A team from the Royal Squatradub had planned to conduct a rally to create awareness among the Pune people to donate eyes.

    #include <stdio.h>

    int main()

    {int people_age,weight;

        scanf("%d%d",&people_age,&weight);

        if(people_age>=18 && weight>=40){

            printf("Eligible for Donation");

        }

        else{

            printf("Not Eligible for Donation");

        }

    return 0;

    }

    Abilash and Yarhini are friends who love to go for outing every month

    #include <stdio.h>

    int main()

    {

        int month;

        scanf("%d",&month);

        switch(month){

            case 1:

            case 3:

            case 5:

            case 7:

            case 8:

            case 10:

            case 12:

            printf("31 days");

            break;

           

            case 4:

            case 6:

            case 9:

            case 11:

            printf("30 days");

            break;

           

            case 2:

            printf("28/29 days");

            break;

        }

       

     

                   return 0;

    }

    Rashi’s classroom contains N M tables distributed is a grid with N rows and M columns

    #include <stdio.h>

    int main()

    {int n,m;

        scanf("%d%d",&n,&m);

        if((n*m)%2==0){

            printf("YES");}

        else{

            printf("NO");}

    return 0;

    }

    You are playing a Billiards like game on an NxN table,

    #include <stdio.h>

    int main()

    {

        int n,k,x,y;

        int x1,x2,x3,x4,y1,y2,y3,y4;

        scanf("%d%d%d%d",&n,&k,&x,&y);

       

        x1=x+n-x;

        y1=y+n-x;

       

        x2=y1;

        y2=x1;

       

        x3=x2-x2;

        y3=y2-x2;

       

        x4=y3;

        y4=x3;

       

        if(x1==y1)

        printf("%d %d",x1,x2);

        else

        {

            if(k%4==1)

            printf("%d %d",x1,y1);

            else if(k%4==2)

            printf("%d %d",x2,y2);

            else if(k%4==3)

            printf("%d %d",x3,y3);

            else

            {printf("%d %d",x4,y4);}

        }

        return 0;

    }

    Yesterday, Loki found K empty boxes in the cooler and decided to fill them with apples

    #include <stdio.h>

    int main()

    {int n,k;

        scanf("%d%d",&n,&k);

        if(n%k==0){

            printf("YES");}

        else{

            printf("NO");}

    return 0;

    }

    Fazil and Yathra are playing a game.

    #include <stdio.h>

    int main()

    {

        int a,b,c,d,n;

        scanf("%d%d%d",&a,&b,&n);

        c=(2*a)/b;

        d=(4*a)/(2*b);

        if(n==1)

        {

        printf("%d",c);

        }

        else if(n%2==0)

        {

        printf("%d",a/b);

        }

        else

        printf("%d",d);

        return 0;

    }

    7 am not in danger. Girish

    #include <stdio.h>

    int main()

    {

        int x,y;

        scanf("%d %d",&x,&y);int c;

        if((x-y)%2==0)

        c=(x>y)?1:3;

        else{if(x>y) c=2;

        else if(y>x) c=1;

        else c=0;}

         printf("%d",c);

                   return 0;

    }

    The Paytm announced a Cashback offer for the people of Tamil Nadu which is a one time offer for the new year

    #include <stdio.h>

    int main()

    {

        int currency;

        scanf("%d",&currency);

        (currency%2==0) ?

        (printf("Even Currency")) :

        (printf("Odd Currency"));

     

                   return 0;

    }

    Mr. Issac the Head of Tamil Nadu Meteorological Department have instructed his team members to analyse the temperature of all the cities in Tamil Nadu

    #include <stdio.h>

    int main()

    {

        float celsius, fahrenheit;

        scanf("%f",&fahrenheit);

        celsius=(fahrenheit-32)*5/9;

        if(celsius>=150){

            printf("%.2f Centigrade\nVery Hot",celsius);

        }

        else if(celsius>=100){

            printf("%.2f Centigrade\nHot",celsius);

        }

        else{

            printf("%.2f Centigrade\nModerate",celsius);

        }

     

                   return 0;

    }

    Bachgold problem is very easy to formulate

    #include <stdio.h>

    int main()

    { int pos,i;

      scanf("%d",&pos);

      printf("%d\n",pos/2);

      if(pos%2==0)

       { for(i=0;i<pos/2-1;i++)

          printf("2 ");

        printf("2\n");

       }

      else if(pos%2==1)

       { for(i=0;i<pos/2-1;i++)

          printf("2 ");

        printf("3\n");

       }

      return 0;

    }

    Yasir has an array aops consisting of N positive integers. He would like to perform following operation on array.

    #include <stdio.h>

    void rudy(){}

    int main()

    {int n,q,aops[100000];

    int i,min,max,b;

    scanf("%d %d",&n,&q);

    for(i=0;i<n;i++)

    scanf("%d",&aops[i]);

    min=max=aops[0];

    for(i=0;i<n;i++)

    {

        if(min>aops[i])

        min=aops[i];

        if(max<aops[i])

        max=aops[i];

    }

    while(q–)

    {

        scanf("%d",&b); // number that has to be checked

        (b>=min&&b<=max)?printf("Yes\n"):printf("No\n");

    }

                   return 0;

    }                                                                                                                                

    Venkatesa Raja is an National award wining craft artist who is famous for his “Bhakthakrisha”,

    #include <stdio.h>  

    int main()

    {int A[10][10],t,n,i,j;

    scanf("%d",&t);

    while(t–)

     { scanf("%d",&n);

         for(i=1;i<=n;i++)

    {for(j=1;j<=n;j++)

         scanf("%d",&A[j][i]);

    }

    for(j=1;j<=n;j++)

    {for(i=n;i>=1;i–)

    printf("%d ",A[j][i]);

    }

    printf("\n");

    }

    return 0;

    }

    Snowbell is a little cat. But despite the fact he is still a kitten he already knows about the pretty things that coins are.

    #include <stdio.h> // what we have to check is the remainder we get by calling people one by one

    void rudy(){}

    int main()            

    {int t,n,k,c,i; // here k are the total people from whom the cat calls

    scanf("%d",&t);

    while(t–)

    {c=0;

        scanf("%d %d",&n,&k);

        for(i=1;i<=k;i++) // i starts from 1 as dog has to call atleast one person

        {if(n%i>c) // check if remaining coins are more than previous

        c=n%i;

        }

        printf("%d\n",c);

    }

                   return 0;

    }

    Yarwanth need to find a string which has exactly K positions in it such that the character at that position comes alphabetically later than the character immediately after it

    #include <stdio.h>

     

    #include <string.h>

     

    int main()

     

    {char K[105];

     

    char t[]="This is SHIT";

     

    int n,v,i;

     

    char c = 'a';

     

    scanf("%d",&n); while(n>0){

     

    scanf("%d",&v); for (i = v; i >=0; i–){ printf("%c", (c+i));}

     

    strcat(K,t); printf("\n");

     

    n–;

    }

    return 0;

    }

     

    Leave a Reply

    Back to Top