Posts

Showing posts from October, 2019

while loop and their program write a name ten time using while loop in netbeans

Image
Q  write a name ten time using  while loop in netbeans while loop  programming tips  syntax  #include <stdio.h> #include <stdlib.h> /*  *   */ int main(int argc, char** argv) {     int i=1;                                      //  initialive loop variable     while(i<=10)                            //   test the condition      {                                                // execute the loop                                                ...

Create a structure TIME with members hours, minutes and seconds. Write a C program to add two time objects by passing structure variables to function and display result in H: M: S format.

Image
Q .  Create a structure TIME with members hours, minutes and seconds. Write a C program to add two time objects by passing structure variables to function and display result in H: M: S format.                                                                    PROGRAM .   #include <stdio.h> #include <stdlib.h> /*   *   */ struct time {     int hours,minutes,seconds; }; int main(){         struct time t1,t2,temp;     printf("enter the times in hours,minutes,seconds");     scanf("%d%d%d",&t1.hours,&t1.minutes,&t1.seconds);         printf("enter the times in hours,minutes,seconds");     scanf("%d%d%d",&t2.hours,&t2...

Create a structure named company which has name, address, phone and no of Employee as member variables. Read name of company, its address, phone and no of Employee. Finally display these members’ value.

Image
      Q .  Create a structure named company which has name, address, phone and no of Employee as member variables. Read name of company, its address, phone and no of Employee. Finally display these members’ value. ans .                                                  PROGRAM       #include <stdio.h> #include <stdlib.h> struct company {     char name[20],address[50];     int phone,noOfEmployee; }; int main(){         struct company C1;     printf("enter the details of the company");     scanf("%s%s%d%d",C1.name,C1.address,&C1.phone,&C1.noOfEmployee);     printf("Details of the company");     printf("company name=%s \n company address=%s \n co...